投稿 评论 顶部

thinkphp 5.0的nginx伪静态规则

佚名 网络安全

?踩坑很久才试成功

server {?? ?listen 80;?? ?server_name **.com;?? ?root "C:/wwwroot/**/public";?? ?location / {?? ??? ?index index.html index.htm index.php default.php;//重点就是加入下面这个if? ? ? ? if (!-e $request_filename){? ? ? ? rewrite ?^(.*)$ ?/index.php?s=$1 ?last; ? break;? ? }?? ?}?? ?location ~ .php(.*)$ {?? ??? ?fastcgi_pass 127.0.0.1:18158;?? ??? ?fastcgi_index index.html;?? ??? ?fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;?? ??? ?fastcgi_split_path_info ^(.+.php)(.*)$;?? ??? ?fastcgi_param PATH_INFO $fastcgi_path_info;?? ??? ?include fastcgi_params;?? ?}}? ??

?