Skip to content

Instantly share code, notes, and snippets.

@namnv609
Created June 24, 2016 04:32
Show Gist options
  • Save namnv609/4b5c33c9a58bef8c929d2d3e76d0c159 to your computer and use it in GitHub Desktop.
Save namnv609/4b5c33c9a58bef8c929d2d3e76d0c159 to your computer and use it in GitHub Desktop.
ActionCable WebSocket with NginX proxy
server {
listen 80;
listen 443 ssl;
server_name servername.domain;
ssl on;
ssl_certificate /etc/apache2/ssl/apache.crt;
ssl_certificate_key /etc/apache2/ssl/apache.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://0.0.0.0:3000;
proxy_redirect off;
}
location /cable {
proxy_pass http://0.0.0.0:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment