……而 web.socketed.template 则进入了 ![]()
这个让我有些困惑……我的 Discourse 配置在 HTTPS 方面看似完美无缺,唯独 certificate.svg 无法加载(错误 500,这不是 bug,肯定是我自己的设置问题
)
- 我使用的是 web.socketed.template,并在容器外部处理 SSL(因此 app.yml 中 web.ssl.template 仍处于注释状态)
- Rails 日志显示:
Failed to process hijacked response correctly : Failed to open TCP connection to my.domain:443 (Connection refused - connect(2) for "my.domain" port 443)
我进入容器查看 /etc/nginx/conf.d/discourse.conf 的内容,正如预期,我没有看到任何 https 块(如果启用了 web.ssl.template,我认为应该会出现)。
是否有可能 web.socketed.template 中的以下部分:
- replace:
filename: "/etc/nginx/conf.d/discourse.conf"
from: /listen 443 ssl http2;/
to: |
listen unix:/shared/nginx.https.sock ssl http2;
set_real_ip_from unix:;
由于未启用 web.ssl.template 而无法应用,从而导致 hijack 失败?
但为什么只有 discobot 的证书会出问题?hijack 不是经常被使用吗,比如用于 oneboxing?唉……我已经超出我的知识范围了,头都疼了 ![]()
附:SSL 片段
ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:1m;
ssl_session_tickets off;
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers off;
add_header Strict-Transport-Security 'max-age=31536000';
以及 nginx 配置块
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name my.domain;
ssl on;
ssl_certificate /etc/letsencrypt/live/my.domain/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/my.domain/privkey.pem;
include /etc/nginx/snippets/ssl.conf;
client_max_body_size 0;
http2_idle_timeout 5m;
location / {
proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock:;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}