问下大家nginx如何配置http,https,wss
我这边服务器上有一个服务node服务,监听8080端口,这服务是将视频流变成可以直接网页播放的帧,然后就需要在服务器上配置websocket,这样前端就能直接对接这服务,然后我用宝塔已经申请了ssl证书了,然后nginx里面配置了https,然后
if ($server_port !~ 443){
rewrite ^(/.*)$ https://$host$1 permanent;
}
其他端口都强制转到https,
现在是https能访问,我在nginx里面配置wss
location /wss {
proxy_pass http://127.0.0.1:8080/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 600s;
}
当我用wss://域名:8080时就提示连接失败,用ws://ip地址:8080时提示连接成功,能教我下如何配置websocket吗,ip地址的那个nginx我都没有配置wss直接就成功了?
推荐文章: