云豹直播搭建过程中node聊天接口无法使用的修复方案
1.云豹node服务原始依赖于http协议,目前浏览器已经不支持http和https混合使用,所以需要为node.js支持https.
解决思路如下:
1.使用nginx进行端口转发,将域名转发至云豹的node.js端口19967端口。
2.如何更新ssl证书(宝塔创建一个站点,域名为聊天服务器地址域名,然后申请免费的ssl证书,打开站点配置文件复制ssl证书地址,然后修改到下面的nginx配置文件中)
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name 直播服务器域名;
ssl_certificate /www/server/panel/vhost/cert/***.cn/fullchain.pem;
ssl_certificate_key /www/server/panel/vhost/cert/***.cn/privkey.pem;
client_max_body_size 50m;
client_body_buffer_size 256k;
client_header_timeout 3m;
client_body_timeout 3m;
send_timeout 3m;
proxy_connect_timeout 300s;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
proxy_buffer_size 64k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_ignore_client_abort on;
location / {
proxy_pass http://127.0.0.1:19967;
proxy_redirect https://$host/ https://$http_host/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_ssl_server_name on;
proxy_set_header Host $host;
}
}