Created
May 13, 2019 07:44
-
-
Save 3014zhangshuo/e9671e3f998fa7d40271aea9707d5023 to your computer and use it in GitHub Desktop.
nginx puma websocket config
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
upstream rails_servers { | |
server unix:///opt/app/www.yoursite.com/shared/sockets/puma.sock fail_timeout=0; | |
} | |
server { | |
server_name www.yoursite.com; | |
location /cable { | |
proxy_redirect off; | |
proxy_set_header Host $host; | |
proxy_set_header X-Forwarded-Host $host; | |
proxy_set_header X-Forwarded-Server $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_buffering on; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "Upgrade"; | |
proxy_set_header X-Forwarded-Proto https; | |
proxy_pass http://rails_servers; | |
gzip off; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment