0

我有一个 nginx 容器,它有一个上游到我的 laravel 容器,使用下面的配置文件,我试图添加一个名为的位置cms,然后应该使用我的 laravel 上游服务器。但现在我得到 404 , file not found 错误。我几乎尝试了互联网上的所有解决方案,但没有取得任何成就。

Nignx.conf

            location ^~ /cms/ {
                root /var/www/public;
                try_files $uri $uri/ @cms;              

                location ~ \.php$ {
                        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
                        fastcgi_pass   redirect;
                        fastcgi_index index.php;
                        include fastcgi_params;
                        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                        fastcgi_param PATH_INFO $fastcgi_path_info;
        }
}
 location @cms{
                       rewrite /cms/(.*)$ /cms/index.php?/$1 last;
                       #try_files $uri $uri/ /index.php?$query_string;
                }

PHP-FPM 日志

172.10.9.91 -  17/Sep/2020:14:29:59 +0000 "GET /cms/index.php" 404

172.10.9.91 -  17/Sep/2020:14:30:05 +0000 "GET /cms/index.php" 404

172.10.9.91 -  17/Sep/2020:14:30:20 +0000 "GET /cms/index.php" 404

172.10.9.91 -  17/Sep/2020:14:30:30 +0000 "GET /cms/index.php" 404

当我尝试通过删除来更改上述配置文件时/cms/index.php?/1$,似乎 Nginx 不使用上游服务器,并且代码在我当前的主域上给出了 404。

4

0 回答 0