Fork me on GitHub

Bazingafraser

导航

搭建微信小程序基本的https与wss环境

nginx基本配置如下:

upstream websocket {
server 127.0.0.1:8222;# 远程websocket服务器地址
}
upstream web{
server 127.0.0.1:8080;# 远程http接口
}

  

server
{
listen 80;
listen 443;
ssl on;
ssl_certificate cert/server.pem;
ssl_certificate_key cert/server.key;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!ADH:!EXPORT56:RC4+RSA:+MEDIUM;
ssl_prefer_server_ciphers on;
server_name www.ceshi.com;
location / {
proxy_redirect off;
proxy_ignore_client_abort on;
proxy_set_header Host www.ceshi.com;
#proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://web;
access_log /data/weblogs/nginx/coint.laiqugame.com.access.log;
}
location /wss {
proxy_pass http://websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
access_log /data/weblogs/nginx/coint-wss.laiqugame.com.access.log;
}
}

  

posted on 2018-05-11 11:33  Bazingafraser  阅读(389)  评论(0编辑  收藏  举报