- 只需要修改3個地方就可以了,親測成功,看代碼有注解
-
location ~ \.php { #去掉$
root E:/phpStudy/WWW/tp/public/;
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; - 下面是我完整的一個虛擬域名配置
-
server {
listen 80;
server_name www.cs.com;
root "E:/phpStudy/WWW/cs/public/";
location / {
index index.html index.htm index.php l.php;
autoindex on;
try_files $uri $uri/ /index.php?s=$uri&$args;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php { #去掉$
root E:/phpStudy/WWW/cs/public/;
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;}
}
如果要看tinkphp5的nginx配置文件的話 這里有位大神給出了具體方式 傳送門:http://www.thinkphp.cn/topic/40391.html