【发布时间】:2019-04-08 03:22:52
【问题描述】:
我的 Wordpress 网站应该出现在 http://192.168.122.50/blog/
我从创建这个服务器块开始
server {
server_name 192.168.122.50;
listen 80;
location /blog/ {
proxy_pass http://localhost:8000; # My Wordpress site
}
}
接下来,我将以下两行添加到我的 Wordpress 配置 (wp-config.php):
define( 'WP_HOME', 'http://192.168.122.50/blog/' );
define( 'WP_SITEURL', 'http://192.168.122.50/blog/' );
我不断收到指向此 URL 的无限重定向循环:http://192.168.122.50/blog/wp-admin/install.php
这是我收到的 HTTP 响应,根据 httpie:
HTTP/1.1 302 Found
Cache-Control: no-cache, must-revalidate, max-age=0
Connection: keep-alive
Content-Length: 0
Content-Type: text/html; charset=UTF-8
Date: Sun, 07 Apr 2019 15:13:50 GMT
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Location: http://192.168.122.50/blog/wp-admin/install.php
Server: nginx/1.12.2
X-Powered-By: PHP/7.2.17
X-Redirect-By: WordPress
我试图通过在 proxy_pass 之后添加以下行来解决此问题,但无济于事。
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
另外,我正在使用wordpress:latest Docker 映像。
【问题讨论】:
标签: wordpress docker nginx reverse-proxy