2

The css files are loading but the issue is that they're not applying, but here's the strange part. If I edit it in chrome in any way (typing a character and deleting it), the style sheet applies. I'm fairly certain the issue is with nginx because when I run a local server (node.js http-server), the css file works.

I added this to my config to make sure it was sending and being interpreted as the right type of file but it still doesn't work.

location ~ \.css {
  add_header Content-Type text/css;
}

This is the website if anyone wants to look at it or try editing the css file.

1 Answer 1

7

If you have a look at the headers sent to the browser, one receives two content-types now which is wrong. The browser interpretes the CSS as plain/text and hence cannot apply the css.

Content-Type:text/plain
Content-Type:text/css

What does your nginx config look like? Do you include /etc/nginx/mime.types; anywhere alike here: https://www.nginx.com/resources/wiki/start/topics/examples/full/

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I was being dumb and didn't include that. This is my first time using nginx. Everything works now!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.