我需要在非标准SSL端口(8080)上运行WordPress实例。我使用Docker容器和nginx作为反向代理。
以下是docker-compose.yml
:
wordpress:
image: wordpress:latest
# no ports are open besides 80 internally exposed
(...)
proxy:
image: jwilder/nginx-proxy
ports:
- "8080:8080"
对于
nginx.conf
:
server {
server_name domain.com;
listen 8080 ssl;
ssl_certificate certs/domain.crt;
ssl_certificate_key certs/domain.key;
# Proxy parameters
#proxy_set_header Host $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;
proxy_buffering on;
location / {
proxy_pass http://wordpress;
}
最合适的回答,由SO网友:That Brazilian Guy 整理而成
正在更改
proxy_set_header Host $host;
到
proxy_set_header Host $http_host;
已修复此问题。
(source)