【已解决】phpstudy 切换nginx环境下访问项目提示404,找不到文件
phpstudy 切换nginx环镜 以url路由方式访问 ''域名/控制器/方法'' 提示404,找不到文件
解决方法:
server {
listen 80;
server_name www.tp5.io;
root "D:/phpStudy/PHPTutorial/WWW/tp5/public";
location / {
index index.html index.htm index.php;
#autoindex on;
#手动添加伪静态
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
₉₄₇ 2019-11-27 17:09:591楼
server {
listen 80;
#虚拟域名
server_name www.tp5.io;
#项目路径
root "D:/phpStudy/PHPTutorial/WWW/tp5/public";
location / {
index index.html index.htm index.php;
#autoindex on;
#手动添加伪静态
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
赞 +添加回复