在ThinkPHP5中 發現URL 不支持典型模式訪問 http://serverName/index.php(或者其它應用入口文件)/模塊/控制器/操作/[參數名/參數值...]
因為默認nginx不支持PATHINFO 只能通過http://serverName/index.php(或者其它應用入口文件)?s=/模塊/控制器/操作/[參數名/參數值...]
感覺好煩哦 於是就想辦法修改配置
location ~ .php$ { //$代表結尾,這樣對於后面跟隨內容的URL地址就不會進行解析
fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; }
上面的配置Nginx是不會正交給php cgi服務器的. 所以我們需要改寫這段配置為:
location ~ .php {
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$; #增加這一句
fastcgi_param PATH_INFO $fastcgi_path_info; #增加這一句 fastcgi_pass 127.0.0.1:9000; include fastcgi_params; }