The day nginx swallowed our CSS

💻 💬

🩺 Summary

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.

📝 Details

Nginx static alias is tricky. The alias was /home/ainomam/static/ but CSS lived at /home/ainomam/static/css/. One missing directory level caused 404s for all CSS.
Use root instead of alias when possible. Test with curl -I before declaring victory.