Skip to content

Instantly share code, notes, and snippets.

@chanjarster
Created December 29, 2017 02:38
Show Gist options
  • Save chanjarster/b228c7f998d1d81a5797ec7bfbd24ad2 to your computer and use it in GitHub Desktop.
Save chanjarster/b228c7f998d1d81a5797ec7bfbd24ad2 to your computer and use it in GitHub Desktop.
Nginx反向代理具有WebSocket应用的配置文件
http {
// ssl 相关配置 ...
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 8020;
location /ws {
proxy_pass http://some-ip:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Origin "";
proxy_read_timeout 86400;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment