Skip to content

Instantly share code, notes, and snippets.

@KostyaEsmukov
Last active August 20, 2016 11:06
Show Gist options
  • Save KostyaEsmukov/d145c45b8f204dbe8419a23940b51963 to your computer and use it in GitHub Desktop.
Save KostyaEsmukov/d145c45b8f204dbe8419a23940b51963 to your computer and use it in GitHub Desktop.
Nginx performance tunings - minimal configuration

Nginx performance optimizations

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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment