除了首頁,訪問其他路由頁面都出現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