Skip to content

Instantly share code, notes, and snippets.

@Unitech
Last active April 14, 2020 17:48
Show Gist options
  • Save Unitech/ec40871357db0257e76d6899cb6762dc to your computer and use it in GitHub Desktop.
Save Unitech/ec40871357db0257e76d6899cb6762dc to your computer and use it in GitHub Desktop.
NGINX/PM2
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 128M;
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 vsapi {
server 127.0.0.1:3010;
keepalive 64;
}
server {
listen 443 ssl http2;
ssl on;
ssl_certificate /etc/ssl/XXX.crt;
ssl_certificate_key /etc/ssl/YYY.key;
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomain";
ssl_prefer_server_ciphers on;
server_name *;
keepalive_timeout 10;
location /api {
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Connection "";
proxy_pass http://vsapi;
}
}
}
@alexellis
Copy link

I'm getting socket leaks with a similar configuration. How is this working out for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment