worker_processes 4; events { worker_connections 1024; } http { ssl_session_cache shared:SSL:10m; ssl_session_timeout 30m; #See http://blog.argteam.com/coding/hardening-node-js-for-production-part-2-using-nginx-to-avoid-node-js-load proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m; proxy_temp_path /var/tmp; include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; gzip on; gzip_comp_level 6; gzip_vary on; gzip_min_length 1000; gzip_proxied any; gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; gzip_buffers 16 8k; upstream node-upstream { least_conn; server node1:8080 weight=10 max_fails=3 fail_timeout=30s; server node2:8080 weight=10 max_fails=3 fail_timeout=30s; server node3:8080 weight=10 max_fails=3 fail_timeout=30s; keepalive 64; } server { listen 80; server_name 192.168.99.100; #server_name ${APP_NAME}.com www.${APP_NAME}.com; root /var/www/public; # Handle static files location /app/ { access_log off; expires 1d; } location /theme/ { access_log off; expires 1d; } location / { proxy_pass http://node-upstream; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-NginX-Proxy true; proxy_cache_bypass $http_upgrade; } #return 301 https://$server_name$request_uri; } }