Back to Linter
Warningperformance

Static File Caching Disabled

How to configure browser caching for static assets in Nginx.

What This Rule Checks

This rule checks if static file caching (expires/Cache-Control headers) is configured.

Why It Matters

Without caching headers, browsers re-download static assets on every visit. Adding `expires` or `Cache-Control` headers for CSS, JS, and images allows browsers to cache them, dramatically reducing page load times for returning visitors.

Bad — Triggers this rule

location /static {
    root /var/www;
    # No caching headers — every visit re-downloads assets
}

Good — Passes this rule

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

How to Fix

Enable static file caching in Configen's Performance section and set an appropriate cache duration (e.g., 30 days for versioned assets).

Related Rules

Check your config now

Paste your nginx.conf and get instant feedback on 20+ rules.

Open Linter →