laravel 浏览器访问404错误
原因1:nginx伪静态的问题
参考: https://learnku.com/docs/laravel/8.x/deployment/9359
配置nginx 的vhost
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
#include /usr/local/nginx/conf/rewrite/none.conf;
charset utf-8;
#error_page 404 /404.html;
#error_page 502 /502.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
原因2:项目需要登陆鉴权
由于项目有登录鉴权的模块,所以需要先登录后台,然后再访问项目中的路由