Skip to content

Instantly share code, notes, and snippets.

@youqingkui
Last active August 29, 2015 14:27
Show Gist options
  • Save youqingkui/051eae622e4f8f64168d to your computer and use it in GitHub Desktop.
Save youqingkui/051eae622e4f8f64168d to your computer and use it in GitHub Desktop.
nginx代理websocket
server {
listen 80;
server_name your domain name;
location / {
proxy_pass http://localhost:3002; #填写程序端口地址
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
# 参考:
# [Nginx反向代理Websocket](https://app.yinxiang.com/shard/s5/nl/341662775/fe519de1-f61e-4140-90cb-68b444cb2809/)
# [NGINX as a WebSocket Proxy - NGINX](https://app.yinxiang.com/shard/s5/nl/341662775/4b122316-9d4a-4edb-897a-fca168c21ebe/)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment