Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么nginx会显示“为什么?”;“未找到文件”;访问';php';文件夹?_Php_Nginx_Fpm - Fatal编程技术网

为什么nginx会显示“为什么?”;“未找到文件”;访问';php';文件夹?

为什么nginx会显示“为什么?”;“未找到文件”;访问';php';文件夹?,php,nginx,fpm,Php,Nginx,Fpm,我在网上遇到过许多类似的问题,但没有一个解决方案奏效。诚然,我对内部工作原理的理解是有限的,但我确实知道我当前的nginx配置已经工作了几个月,直到昨天晚上 server { index index.html index.php; server_name XXX.xxx; root /var/www/ZZZ/; location / { try_files $uri $uri/ =404; } location ~\.php$

我在网上遇到过许多类似的问题,但没有一个解决方案奏效。诚然,我对内部工作原理的理解是有限的,但我确实知道我当前的nginx配置已经工作了几个月,直到昨天晚上

server {
    index index.html index.php;
    server_name XXX.xxx;
    root /var/www/ZZZ/;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~\.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.3-fpm.sock;
    }
    
    ...

}
fastcgi-php.conf包含以下内容:

# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+?\.php)(/.*)$;

# Check that the PHP script exists before passing it
try_files $fastcgi_script_name =404;

# Bypass the fact that try_files resets $fastcgi_path_info
# see: http://trac.nginx.org/nginx/ticket/321
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;

fastcgi_index index.php;
include fastcgi.conf;

在包含的文件
fastcgi.conf
中,是否为
SCRIPT\u FILENAME
设置值?在包含的文件
fastcgi.conf
中,是否为
SCRIPT\u FILENAME
设置值?