Skip to content

Instantly share code, notes, and snippets.

@shokai
Last active September 9, 2018 15:05
Show Gist options
  • Save shokai/122ce3bc39af31831624103fa500a974 to your computer and use it in GitHub Desktop.
Save shokai/122ce3bc39af31831624103fa500a974 to your computer and use it in GitHub Desktop.
nginx websocket proxy
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
upstream app {
server localhost:8080;
}
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Document-Root $document_root;
proxy_set_header X-Document-URI $document_uri;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://app;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment