Skip to content

Instantly share code, notes, and snippets.

@FZambia
Created May 6, 2015 19:58
Show Gist options
  • Save FZambia/c4a7f4d8764bc9330517 to your computer and use it in GitHub Desktop.
Save FZambia/c4a7f4d8764bc9330517 to your computer and use it in GitHub Desktop.
centrifuge nginx conf
upstream centrifuge {
# Enumerate all the Tornado servers here
#sticky;
ip_hash;
server 127.0.0.1:8000;
#server 127.0.0.1:8001;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
#server {
# listen 80;
# server_name centrifuge.example.com;
# rewrite ^(.*) https://$server_name$1 permanent;
#}
server {
server_name centrifuge.example.com;
listen 80;
#listen 443;
#ssl on;
#ssl_protocols SSLv3 TLSv1;
#ssl_ciphers AES128-SHA:AES256-SHA:RC4-SHA:DES-CBC3-SHA:RC4-MD5;
#ssl_certificate /etc/nginx/ssl/wildcard.example.com.crt;
#ssl_certificate_key /etc/nginx/ssl/wildcard.example.com.key;
#ssl_session_cache shared:SSL:10m;ssl_session_timeout 10m;
include /etc/nginx/mime.types;
default_type application/octet-stream;
keepalive_timeout 65;
proxy_read_timeout 200;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
gzip on;
gzip_min_length 1000;
gzip_proxied any;
# Only retry if there was a communication error, not a timeout
# on the Tornado server (to avoid propagating "queries of death"
# to all frontends)
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://centrifuge;
}
location /socket {
proxy_buffering off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://centrifuge;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
location /connection {
proxy_buffering off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://centrifuge;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment