找不到 php 个文件的文件

File not found for php files

我在 nginx 反向代理后面有 wordpress 运行。

Home 等工作正常,但是当用户以 .php 结尾进入 url 时,我收到 404 File not found. 错误。

这里是相关的nginx配置:

        location /en/us/ {
                proxy_pass https://10.0.10.11/en/us/;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header Host $host;
        }

看起来有另一个规则覆盖所有 php 文件并返回 404。如果您使用的是 bitnami nginx,请编辑以下文件;

sudo vim /opt/bitnami/nginx/conf/bitnami/bitnami.conf

并注释掉

#include "/opt/bitnami/nginx/conf/bitnami/phpfastcgi.conf";

location ~ "\.php$" {
    fastcgi_index index.php;
    if (!-f $realpath_root$fastcgi_script_name) {
        return 404;
    }

    include /etc/nginx/conf/phpfastcgiparam.conf;
    fastcgi_pass unix:/run/php7/php-fpm.sock;
}