Open Leen27 opened 1 year ago
请求地址 ws:// 改成 wss://, nginx 里配置 /wss 转发
server { listen 443 ssl; server_name your-domain.com;
ssl_certificate /path/to/your/certificate.crt; ssl_certificate_key /path/to/your/certificate.key;
location / { proxy_pass http://your-web-server; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; }
location /wss { proxy_pass http://your-websocket-server; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; proxy_redirect off; } }
请求地址 ws:// 改成 wss://, nginx 里配置 /wss 转发
server { listen 443 ssl; server_name your-domain.com;
ssl_certificate /path/to/your/certificate.crt; ssl_certificate_key /path/to/your/certificate.key;
location / { proxy_pass http://your-web-server; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; }
location /wss { proxy_pass http://your-websocket-server; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; proxy_redirect off; } }