map $http_upgrade $connection_upgrade { default upgrade; '' close; } upstream websocket { server yourip:port; } server { listen 443; server_name xxxx.com; ssl on; ssl_certificate /xx/xx/cert.crt; ssl_certificate_key /xx/xx/cert.key; ssl_session_timeout 5m; ssl_session_cache shared:SSL:50m; ssl_protocols TLSV1.1 TLSV1.2 SSLv2 SSLv3; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; ssl_prefer_server_ciphers on; #wss协议转发 小程序里面要访问的链接 # 访问:wss://xxxx.com/wss location /wss { proxy_pass http://websocket;#代理到上面的地址去 proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; } #charset koi8-r; access_log /var/log/nginx/log/xxx.access.log main; location / { root /data/www/xxxx; index index.php index.html index.htm; try_files $uri $uri/ /index.php?$args; } }
稍作调整即可
标签:index,upgrade,nginx,微信,server,ssl,wss,proxy From: https://www.cnblogs.com/agressor/p/17536663.html