找不到php文件的文件

问题描述 投票:-2回答:1

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

家庭等工作正常但当用户使用.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 wordpress nginx reverse-proxy nginx-location
1个回答
0
投票

看起来有另一个规则覆盖所有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;
}
© www.soinside.com 2019 - 2024. All rights reserved.