Disclosure: this page contains affiliate links. If you buy through them we may earn a commission at no extra cost to you.

Nginx is fast out of the box, but a few settings make it dramatically faster. Here are the highest-impact changes.

Turn on gzip

Compress text responses in nginx.conf:

gzip on;
gzip_types text/css application/javascript application/json image/svg+xml;
gzip_min_length 1024;

This typically cuts HTML, CSS, and JS transfer size by 60–80%.

Enable HTTP/2

listen 443 ssl;

On modern Nginx, HTTP/2 is negotiated automatically over TLS.

Cache static files

Tell browsers to cache assets:

location ~* \.(css|js|png|jpg|svg|woff2)$ {
    expires 30d;
    add_header Cache-Control "public, immutable";
}

Add proxy caching

For dynamic apps, enable microcaching with proxy_cache to serve repeated requests without hitting the backend.

Measure before and after with curl -w or Lighthouse so you know what actually helped. These tweaks need no extra RAM — RackNerd’s 1 GB plan at $21.99/yr serves cached pages to hundreds of visitors.

See RackNerd's current deals