现在的情况是:我有一个域名 https://a.bc.com
用了 Nginx
反向代理到本地的 Docker
,容器里用的端口是 8888
,现在刚打开页面是好的,但是一刷新就变成了 https://a.bc.com:8888
求教配置出了什么问题,一下是我的配置:
server {
server_tokens off;
gzip on;
gzip_types application/json application/javascript text/css;
gzip_proxied no-cache no-store private expired auth;
gzip_min_length 1000;
client_max_body_size 500m;
server_name a.bc.com;
location / {
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 https;
proxy_pass http://localhost:8888/;
proxy_redirect http:// https://;
}
listen 443 ssl;
ssl_certificate .....
ssl_certificate_key ......
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIa.bc.comGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
}
server {
if ($host = a.bc.com){
return 301 https://$host$request_uri;
}
server_name a.bc.com;
listen 80;
return 404; # managed by Certbot
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…