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; } }
原文地址:https://www.cnblogs.com/xbxxf/p/9774360.html