Performance Tuning in Nginx

From the Nginx cheat sheet · Caching & Performance · verified Jul 2026

Performance Tuning

Optimizing Nginx for high performance

nginx
# Worker processes
worker_processes auto;
worker_rlimit_nofile 65535;

events {
    worker_connections 4096;
    use epoll;
    multi_accept on;
}

http {
    # Enable compression
    gzip on;
    gzip_types text/plain text/css application/json application/javascript;

    # Keep-alive
    keepalive_timeout 65;
    keepalive_requests 100;
}
⚙️ Tune worker_processes and worker_connections
🗜️ Enable gzip/brotli compression
📈 Use sendfile for static files
🚦 Implement rate limiting for protection

More Nginx tasks

Back to the full Nginx cheat sheet