Created
December 25, 2014 11:41
-
-
Save sigra/8e8fa71cb43ffa8552a7 to your computer and use it in GitHub Desktop.
Nginx configuration for websockets using Thin
This file contains hidden or 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
map $http_upgrade $connection_upgrade { | |
default upgrade; | |
'' close; | |
} | |
upstream thin_websocket { | |
server unix:/path/to/thin/socket/file.sock fail_timeout=0; | |
} | |
server { | |
location /websocket { | |
proxy_pass http://thin_websocket; | |
proxy_redirect off; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
proxy_read_timeout 300; | |
proxy_buffers 32 64k; | |
proxy_buffer_size 64k; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment