小程序中实现websocket
服务器配置
server { listen 443 ssl; server_name weixin.techeek.cn; index index.php index.html index.htm; root /usr/share/nginx/html; ssl_certificate /home/ubuntu/1_weixin.techeek.cn_bundle.crt; ssl_certificate_key /home/ubuntu/2_weixin.techeek.cn.key; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location ~ .php$ { fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
location /wss
{
proxy_pass http://127.0.0.1:8282;#8282gatewaywork的端口
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Real-IP $remote_addr;
}
}

浙公网安备 33010602011771号