在 nginx
中使用代理的一些配置方法
websocket 代理配置
在 nginx
中想要进行 websocket
的 代理需要进行的一些配置:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| http { map $http_upgrade $connection_upgrade { default upgrade; '' close; }
upstream websocket { server 127.0.0.1:5000; }
server { listen 80; location / { proxy_pass http://websocket; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; } } }
|