Skip to content

Instantly share code, notes, and snippets.

@tw3eX
Created June 25, 2015 07:15
Show Gist options
  • Save tw3eX/a03f3e83f05a58c90264 to your computer and use it in GitHub Desktop.
Save tw3eX/a03f3e83f05a58c90264 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 centrifuge;
root /home/forge/centrifuge/app;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
index index.html index.htm index.php;
charset utf-8;
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;
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 '';
}
location ~* \.(png|ico|gif|jpg|jpeg|html|js|css|ico|woff|woff2|tff|svg)$ {
try_files $uri $uri /;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/default-error.log error;
error_page 404 /index.php;
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment