tp5 rewrite nginx 配置


今天弄了個別人的項目,用的tp5,正好前段時間學tp5了,可是人家竟然用了rewrite,我沒學過啊,放在nginx ,全是404,真尷尬

其實很簡單,在配置文件里面添加一小段代碼就ok了

時間緊張直接把配置文件放出來

server {
        listen       80;
        server_name test.wqzsub.com;
        location / {
          root   /var/www/test;
          index  index.php index.html index.htm;
          if (!-e $request_filename) {
           rewrite  ^(.*)$  /index.php?s=$1  last;
           break; }
/*主要加了這一塊*/
}
location ~ \.php$ { root /var/www/test; fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM