添加SSL证书后,我们在聊天中收到以下错误:
WebSocket连接到 ' WSS://ec2-XXXXXXX.us-east-2.compute.amazonaws.com:5002 / WS / blablablabla /' 失败:连接建立错误: 净:: ERR_CERT_AUTHORITY_INVALID
我们正在使用nginx,django和websockets。聊天基于以下存储库:
https://github.com/Bearle/django-private-chat
请参阅此处浏览器日志的屏幕截图:
https://drive.google.com/file/d/1S3WiUlALcNfYEKo3SENMmga9ktDUaNgb/view?usp=sharing
有没有人经历过类似的事情?如果您需要更多有关设置的详细信息,请告诉我。
请参阅下面的nginx配置
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/casista.com-0001/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/casista.com-0001/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
upstream chatserver {
server ec2-13-58-129-240.us-east-2.compute.amazonaws.com:8765;
}
client_max_body_size 4G;
access_log /var/log/nginx/casista-access.log;
error_log /var/log/nginx/casista-error.log;
location = /favicon.ico { access_log off; log_not_found off; }
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://unix:/home/ubuntu/mywasi-root/mywasi/mywasi.sock;
break;
}
# include proxy_params;
location /ws {
# proxy_pass http://ec2-13-58-129-240.us-east-2.compute.amazonaws.com:8765;
proxy_pass http://chatserver;
# proxy_pass http://localhost:8765;
proxy_connect_timeout 7d;
proxy_read_timeout 7d;
proxy_send_timeout 7d;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
auth_basic "Restricted content";
auth_basic_user_file /etc/nginx/.htpasswd;
}
location /static/ {
alias /home/ubuntu/mywasi-root/mywasi/staticfiles/;
autoindex off;
}
location /media/ {
alias /home/ubuntu/mywasi-root/mywasi/media/;
autoindex off;
}