繁体   English   中英

Nginx 返回 404 Not Found 除了索引页

[英]Nginx returns 404 Not Found except index page

这就是我在错误日志中得到的


server {
    listen 80;
    server_name avadore.my.id;
    root /var/www/avadore.my.id/public;

    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;

    charset utf-8;

    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; }

    error_page 404 /index.php;

    location ~ \.php$ {
        try_files $uri /index.php =404;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

基本上这是 conf 文件,我从互联网上尝试了许多解决方案,但没有找到解决方案,但基本上我更改了 try_files $uri $uri/ /index.php?$query_string; to try_files $uri $uri/ /index.php?$is_args$args; 和 404 但仍然没有工作。 感谢任何帮助

我发现问题是我的 laravel 版本是 9 但我认为它只与 php 版本 8 兼容,但我的是版本 7 所以升级 ZE1BFD762321E409CEE4AC0B6E841963C 解决了问题谢谢

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM