crunchbutton/conf/chat.conf
2014-11-06 12:57:56 -08:00

45 lines
1023 B
Plaintext

map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream websocket {
#least_conn;
server localhost:3000;
# fail_timeout=20s;
}
server {
listen 80;
listen 443 ssl;
server_name chat.cockpit.la;
ssl_certificate /home/chat.cockpit.la/ssl/wild.sha-2.cockpit.la.crt;
ssl_certificate_key /home/chat.cockpit.la/ssl/wild.sha-2.cockpit.la.key.private;
# Redirect all non-SSL traffic to SSL.
if ($ssl_protocol = "") {
rewrite ^ https://$host$request_uri? permanent;
}
location / {
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_redirect off;
proxy_pass http://websocket;
proxy_set_header Connection "upgrade";
# proxy_cache_bypass $http_upgrade;
}
# root /home/chat.cockpit.la/www;
# index index.html index.htm;
# location / {
# try_files $uri $uri/ index.html;
# }
}