Last active
August 29, 2015 14:17
-
-
Save alacambra/5bbe1a1298f6a12296e0 to your computer and use it in GitHub Desktop.
nginx-ws
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------- 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