Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We migrated our web servers to Nginx mainly for performance reason, flexibility and ease of configuration (In this regard, a great load of satisfaction!).

However, only one site showed a strange behavior: it loads in its <head> a CSS

<link type="text/css" rel="stylesheet" href="/css/appli-test-local/appli.css">

and Firefox refuses to load the CSS file, complaining that the mime type is not css

The stylesheet was not loaded because its MIME type, "text/html", is not "text/css".

while removing the dashes - works

<link type="text/css" rel="stylesheet" href="/css/applitestlocal/appli.css">

Nginx config

Regarding the Nginx config, its has been checked several times, against the numerous examples on the Net, the mime.types file contains

text/html                             html htm shtml;
text/css                              css;

and the nginx.conf for the main part

http {
  include    /etc/nginx/mime.types;
  include    /etc/nginx/fastcgi.conf;

  default_type application/octet-stream;

Is it likely to be a bug in Nginx having a hard time with dashes? Nginx being a well written piece of software, I'd be surprised, but it could be. Do I miss something obvious?

The problem happens only in Firefox, because FF does care about the mime types (which is a good thing!).

share|improve this question
please post your nginx version, and dont forget to restart after change nginx configuration. and clear browser cache. – user58857 Nov 1 '10 at 14:10
Version 0.7.67. – ringø Nov 1 '10 at 14:35

If you installed Nginx through your default distro repo then you're most likely using a very outdated version of Nginx which might very well contain such a bug.

For testing you should try either finding an updated repo or compiling the latest version from source. If that does not help then paste server OS and whole config file.

share|improve this answer
That was not the problem. I compiled the latest nginx, and the problem was still there. – ringø Aug 24 '12 at 2:39
up vote 0 down vote accepted

I compiled the latest nginx at the time, and the problem was still there. It seems it is a nginx bug in the path / regexp parsing that doesn't handle well dashes.

No relevant answer, so I'll accept this one.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.