1.站点伪静态加wss配置
location /wss {
proxy_pass http://127.0.0.1:20014;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
2. 移动端修改文件,改成下面这样
if (document.location.protocol == "https:") {
that.ws = new WebSocket("wss://" + document.domain + "/wss"+'?uid='+window.uid+'&room='+window.room);
} else {
that.ws = new WebSocket("ws://" + document.domain + ":" + port+'?uid='+window.uid+'&room='+window.room);
}
3. pc端修改文件
var url = '';
if(window.location.protocol.indexOf('https') == -1) {
url = window.location.protocol.replace('http', 'ws') + '//' + window.location.hostname;
}else{
url = window.location.protocol.replace('https', 'wss') + '//' + window.location.hostname + '/wss';
}
if (options.port) {
if (window.location.protocol.indexOf('wss') == -1) {
url += ':' + options.port;
}
}
4.在宝塔中给知识付费站点配置证书,知识付费后台基础配置下的网站网站链接改成https;并且网站所有访问链接均改成https,包括微信公众号菜单等
5.使用命令php think workerman status检查workerman是否开启中,若是开启需要使用命令php think workerman stop 关闭然后开启workerman;如果关闭直接开启workerman。
这样直播使用https就可以实现了
{{item.user_info.nickname ? item.user_info.nickname : item.user_name}}
作者 管理员 企业
{{itemf.name}}
{{itemc.user_info.nickname}}
{{itemc.user_name}}
回复 {{itemc.comment_user_info.nickname}}
{{itemf.name}}