The day nginx swallowed our CSS
We deployed a shiny new template. The HTML rendered beautifully on localhost. But on production the CSS was gone. Just raw unstyled HTML. We checked file paths. We checked permissions. Turned out nginx was serving a stale cached version from a wrong directory. The static alias pointed one level too deep. Four hours.
💡 What You Will Learn
We deployed a shiny new template. The HTML rendered beautifully on localhost. But on production the CSS was gone. Just raw unstyled HTML. We checked file paths. We checked permissions. Turned out ngin
The CSS File That Nginx Ate
Redesigning the site, I added a new CSS file. Opened the browser—styles didn't load.
Checked with F12: CSS returned 404. But the file was perfectly fine on the server.
curl locally—200. curl via domain—404.
It was an nginx issue. After digging through the config for ages, I found that the static file location's priority had been hijacked by another rule.
Fix: Move the static file location to the front, reload nginx. CSS was back.
Two hours. All for a missing priority. For those of you building websites, you know the drill.
Written by our editorial team; tools listed here are tested or verified against public sources. Links point to official sites or GitHub repos for reference only — no paid placements.
