Created
April 18, 2015 07:18
-
-
Save foru17/3e31cb313bba4cd227bf to your computer and use it in GitHub Desktop.
nginx websocket配置
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
# we're in the http context here | |
map $http_upgrade $connection_upgrade { | |
default upgrade; | |
'' close; | |
} | |
# Node Nginx 配置 | |
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; | |
proxy_set_header Host $host; | |
proxy_http_version 1.1; | |
# 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