The configs below are for Linux.
These are the most competent tunings I've found.
| server { | |
| listen 80 default_server deferred; | |
| listen [::]:80 default_server deferred; | |
| listen 443 default_server ssl http2 deferred; | |
| listen [::]:443 default_server ssl http2 deferred; | |
| server_name _; | |
| # ... the rest of your config | |
| } |
| worker_processes auto; | |
| events { | |
| # http://nginx.org/en/docs/events.html | |
| use epoll; | |
| worker_connections 2048; | |
| multi_accept on; | |
| } | |
| http { | |
| # ... the rest of your config | |
| sendfile on; | |
| sendfile_max_chunk 512k; | |
| tcp_nopush on; | |
| tcp_nodelay on; | |
| # use this only when your nginx server serves static files | |
| open_file_cache max=1000 inactive=20s; | |
| open_file_cache_valid 30s; | |
| open_file_cache_min_uses 2; | |
| open_file_cache_errors off; | |
| # ... the rest of your config | |
| } |