Skip to content

Instantly share code, notes, and snippets.

@alacambra
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alacambra/5bbe1a1298f6a12296e0 to your computer and use it in GitHub Desktop.
Save alacambra/5bbe1a1298f6a12296e0 to your computer and use it in GitHub Desktop.
nginx-ws
------- DEPLOYMENT SERVER WS CONFIG ------------
server {
listen 0.0.0.0:80;
server_name {DOMAIN};
location / {
proxy_pass http://{TARGET}:{PORT}/;
}
location ~*/ws/chats/(.*) {
proxy_pass http://{TARGET}:{PORT}/ws/chats/$1$is_args$args;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
access_log /var/log/nginx/default_access.log;
error_log /var/log/nginx/default_error.log;
client_max_body_size 1000M;
}
----- MAIN PROXY PROXY CONF --------------
server {
listen 0.0.0.0:80;
server_name ~^(?<subdomain>.+)\.dev\.intern\.poolingpeople\.com;
location / {
proxy_pass http://$subdomain.dev.intern.poolingpeople.com;
}
location ~*/ws/chats/(?<talk>.*) {
proxy_pass http://$subdomain.dev.intern.poolingpeople.com/ws/chats/$1$is_args$args;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
access_log /var/log/nginx/default_access.log;
error_log /var/log/nginx/default_error.log;
}
----AND THE WINNER IS.....
server {
listen 0.0.0.0:80;
server_name *.dev.intern.poolingpeople.com;
location / {
proxy_pass http://dev.intern.poolingpeople.com;
proxy_set_header Host $host;
}
location /ws/chats/ {
proxy_pass http://dev.intern.poolingpeople.com;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
access_log /var/log/nginx/default_access.log;
error_log /var/log/nginx/default_error.log;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment