我正在尝试为Superdesk的实例配置 HTTPS,该实例使用 Gunicorn 和 Nginx 进行路由。我安装了证书并且(我认为)在服务器上工作。然而,将浏览器指向应用程序会在 Firefox 和“WebSocket 连接到'ws://localhost/ws' 失败:Chrome 上的连接建立错误:net::ERR_CONNECTION_REFUSED"。这个应用程序的文档几乎不存在,我现在花了无数个小时试图让它工作。我在 GitHub 上向开发人员提交了一个问题,但我没有得到太多的答案。这是我的 Nginx 配置:
server {
listen 80;
listen 443 ssl;
server_name my_server_name;
ssl on;
ssl_certificate /path/to/my/cert.pem;
ssl_certificate_key /path/to/my/key/key.pem;
location /ws {
proxy_pass http://localhost:5100;
proxy_http_version 1.1;
proxy_buffering off;
proxy_read_timeout 3600;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location /api {
proxy_pass http://localhost:5000;
proxy_set_header Host localhost;
expires epoch;
sub_filter_once off;
sub_filter_types application/json;
sub_filter 'http://localhost' 'http://$host';
}
location /contentapi {
proxy_pass http://localhost:5400;
proxy_set_header Host localhost;
expires epoch;
}
location /.well-known {
root /var/tmp;
}
location / {
root /opt/superdesk/client/dist;
# TODO: use "config.js:server" for user installations
sub_filter_once off;
sub_filter_types application/javascript;
sub_filter 'http://localhost' 'http://$host';
sub_filter 'ws://localhost/ws' 'ws://$host/ws';
}
location /mail {
alias /var/log/superdesk/mail/;
default_type text/plain;
autoindex on;
autoindex_exact_size off;
}
}
这是我第一次使用 nginx/gunicorn/django 应用程序,我完全迷失了。有人能指出我正确的方向吗?