Skip to content

Instantly share code, notes, and snippets.

@tw3eX
Last active October 13, 2015 07:53
Show Gist options
  • Save tw3eX/d0037ad73de637b1a76e to your computer and use it in GitHub Desktop.
Save tw3eX/d0037ad73de637b1a76e to your computer and use it in GitHub Desktop.
upstream centrifugo {
ip_hash;
server 127.0.0.1:8002;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name socket.logistics.app;
charset utf-8;
default_type application/octet-stream;
keepalive_timeout 65;
proxy_read_timeout 200;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
proxy_next_upstream error;
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://centrifugo;
}
location /connection {
proxy_buffering off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://centrifugo;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
location /socket {
proxy_buffering off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://centrifugo;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Origin '';
}
access_log off;
error_log /var/log/nginx/default-error.log error;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment