qq_18659737
qq_18659737
2018-10-23 09:40
采纳率: 0%
浏览 2.7k

小程序开发之搭建WebSocket的WSS环境(Nginx+WorkerMan框架+PHP)

求大神帮忙配置Nginx,由于微信小程序请求WebSocket不能带端口号,需要在Nginx上做一个域名转发(代理)
WorderMan端口是8282,主域名用的是80端口,主域名已开启了https
Nginx配置文件内容如下:
server {
listen 80;
root /www/web/lsb_abc_net/public_html/public;
server_name lsb.abc.net lsb.abc.net;
rewrite ^(.*)$ https://$host$1 permanent;
index index.html index.php index.htm;
error_page 400 /errpage/400.html;
error_page 403 /errpage/403.html;
error_page 404 /errpage/404.html;
error_page 503 /errpage/503.html;
location ~ .php$ {
proxy_pass http://127.0.0.1:8282;
include naproxy.conf;
}
location ~ /.ht {
deny all;
}
location / {
try_files $uri @apache;
}
location @apache {
internal;
proxy_pass http://127.0.0.1:88;
include naproxy.conf;
}

}

server {
listen 443;
root /www/web/lsb_abc_net/public_html/public;
ssl on;
ssl_certificate cert/lsb.abc.net.pem;
ssl_certificate_key cert/lsb.abc.net.key;
ssl_prefer_server_ciphers on;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
server_name lsb.abc.net;
index index.html index.php index.htm;
error_page 400 /errpage/400.html;
error_page 403 /errpage/403.html;
error_page 404 /errpage/404.html;
error_page 503 /errpage/503.html;
location ~ .php$ {
proxy_pass http://127.0.0.1:88;
include naproxy.conf;
}
location ~ /.ht {
deny all;
}
location / {
try_files $uri @apache;
}
location @apache {
internal;
proxy_pass http://127.0.0.1:88;
include naproxy.conf;
}

}

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • devmiao
    devmiao 2018-10-23 12:47
    点赞 评论
  • Strong_ding
    Strong_ding 2018-11-08 02:00

    你好像没有配置workman的server 加上这个试试
    里面location是我随便那来测试的 别照搬

     server {
                listen       8282;
                server_name  localhost;
                location / {
                    root   html/workman;
                    index  index.html index.htm;
                }
         }
    
    点赞 评论

相关推荐