作者:火柴没头518_410 | 来源:互联网 | 2023-09-06 15:18
除了首页,访问其他路由页面都出现404在location里面加上try_filesuriuriuriindex.php?$query_string;如果配置文件中
除了首页,访问其他路由页面都出现404
- 在location里面加上 try_files uriuriuri/ /index.php?$query_string;
- 如果配置文件中存在 try_files uriuriuri/ =404;需要将它注释掉或者删掉,否则会报错
我的nginx配置文件如下
server {
listen 80;
server_name www.51growup.com;
root /data/wwwroot/default/51growup/public/;
index index.html index.php index.htm;
location / {
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php7.2-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
}
————————————————
版权声明:本文为CSDN博主「itDream.」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/zmzwll1314/article/details/79708327