Created
May 8, 2014 06:09
-
-
Save electricjesus/e1a3c8790de85dbeb447 to your computer and use it in GitHub Desktop.
NGINX Meteor with Websockets
This file contains 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
# we're in the http context here | |
map $http_upgrade $connection_upgrade { | |
default upgrade; | |
'' close; | |
} | |
# the Meteor / Node.js app server | |
server { | |
server_name yourdomain.com; | |
access_log /etc/nginx/logs/yourapp.access; | |
error_log /etc/nginx/logs/yourapp.error error; | |
location / { | |
proxy_pass http://localhost:3000; | |
proxy_set_header X-Real-IP $remote_addr; # http://wiki.nginx.org/HttpProxyModule | |
proxy_set_header Host $host; # pass the host header - http://wiki.nginx.org/HttpProxyModule#proxy_pass | |
proxy_http_version 1.1; # recommended with keepalive connections - http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_http_version | |
# WebSocket proxying - from http://nginx.org/en/docs/http/websocket.html | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection $connection_upgrade; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment