我有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文件并返回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;
}