Skip to content

Instantly share code, notes, and snippets.

@aug2uag
Created June 2, 2018 03:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aug2uag/16a8e2aaa33e4daefe79058f5d184256 to your computer and use it in GitHub Desktop.
Save aug2uag/16a8e2aaa33e4daefe79058f5d184256 to your computer and use it in GitHub Desktop.
Mutli-websocket (MS) NGINX config
#default
server {
listen 80;
server_name api.foo.com;
client_max_body_size 20m;
keepalive_timeout 30;
location /.well-known/acme-challenge {
root /var/www/letsencrypt;
}
location / {
proxy_pass http://vprd;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
server {
listen 80;
server_name dev.foo.com;
client_max_body_size 20m;
keepalive_timeout 30;
location /.well-known/acme-challenge {
root /var/www/letsencrypt;
}
location / {
proxy_pass http://vdev;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
# nginx.conf
worker_processes auto;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
tcp_nodelay on;
types_hash_max_size 2048;
server_names_hash_bucket_size 64;
client_body_timeout 60;
client_header_timeout 60;
keepalive_timeout 10 10;
send_timeout 60;
client_max_body_size 20M;
client_header_buffer_size 1k;
large_client_header_buffers 4 4k;
gzip on;
gzip_http_version 1.1;
gzip_comp_level 5;
gzip_vary on;
gzip_proxied any;
gzip_min_length 10;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/json application/x-javascript text/javascript image/png image/gif image/x-icon;
gzip_disable "MSIE [1-6].(?!.*SV1)";
upstream vprd {
server 127.0.0.1:4999;
keepalive 64;
}
upstream vdev {
server 127.0.0.1:4998;
keepalive 64;
}
include /etc/nginx/sites-enabled/default;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment