|
最近搞TP5,配置Nginx服务器。玩惯了Apache,发现nginx确实很不一样。尝试了N种方法都无法配置成功。 因为用windows本地开发调试的,根目录下又有多个目录,一直不知道在怎么弄。最后终于找到解决方法。
location ~ \.php { #去掉$
root H:/PHPServer/WWW;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$; #增加这一句
fastcgi_param PATH_INFO $fastcgi_path_info; #增加这一句
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
用这个就可以让TP的pathinfo模式跑起来,试了一下不冲突。 再去掉index.php:
location /sgy/ {
if (!-e $request_filename){
rewrite ^/sgy/public/(.*)$ /sgy/public/index.php?s=$1 last;
}
}
(责任编辑:IT) |
