Micro-channel development requirements must connect with https and wss, here is nginx reverse proxy configuration, own use all normal, hoping to help you. Domain name must be in the development of micro letter backstage set, or not connected, the domain name to the record, or do not pass the audit.
nginx.conf add two lines
wss.conf follows
- upstream login_websocket {
- server 120.*.*.*:20013 weight=1;
- server 120.*.*.*:20014 weight=1;
- server 120.*.*.*:20012 weight=1;
- }
- upstream baseapp_websocket0 {
- server 120.*.*.*:20015;
- }
- upstream baseapp_websocket1 {
- server 120.*.*.*:20016;
- }
- upstream baseapp_websocket2 {
- server 120.*.*.*:20017;
- }
- upstream web {
- .. Server www ** cn: 8081; # port set up their own domain name
- }
- server {
- listen 443;
- #server_name www.goworldcup.cn
- ssl on;
- ssl_certificate /usr/local/nginx/conf/server.crt;
- ssl_certificate_key /usr/local/nginx/conf/server.key;
- ssl_session_timeout 5m;
- ssl_session_cache shared:SSL:50m;
- ssl_protocols SSLv3 SSLv2 TLSv1 TLSv1.1 TLSv1.2;
- ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
- underscores_in_headers on;
- location /login {
- proxy_pass http: // login_websocket; # agent to go to the address above
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "Upgrade";
- }
- location /baseapp0 {
- proxy_pass http: // baseapp_websocket0; # agent to go to the address above
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "Upgrade";
- }
- location /baseapp1 {
- proxy_pass http: // baseapp_websocket1; # agent to go to the address above
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "Upgrade";
- }
- location /baseapp2 {
- proxy_pass http: // baseapp_websocket2; # agent to go to the address above
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "Upgrade";
- }
- #https agreement forwarded small program which you want to access the link
- location /{
- proxy_pass http: // web; # http proxy to the original address to
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- add_header Access-Control-Allow-Origin *; # Set cross-domain access
- }
- }