我在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;
}
答案 0 :(得分: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;
}