nginx wss配置
时间: 2023-10-03 11:02:48 浏览: 110
nginx配置详细说明
Nginx的WSS配置可以通过以下方式进行设置:
```
server {
listen 443 ssl;
server_name im-wss-api.xxx.xxx;
ssl_certificate ../cert/server.crt;
ssl_certificate_key ../cert/server.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://localhost:8088;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
}
```
以上配置使用了SSL证书,并监听443端口,服务器名为im-wss-api.xxx.xxx。在location段内,使用proxy_pass命令将请求转发给本地的8088端口,并设置了升级头信息,以便与客户端建立WebSocket连接。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [系统基于springboot框架,使用Java+vue编写,为前后端分离的微服务项目](https://download.csdn.net/download/Abelon/88250447)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [【高效运维】Nginx下配置WS、WSS](https://blog.csdn.net/u012069313/article/details/124562355)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [详细nginx配置websocket的wss协议](https://blog.csdn.net/web17535224648/article/details/126801300)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文