Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm running into a CSS problem. This is a setup based on Debian Squeeze (nginx/0.7.67, php5/cgi) on which I installed the latest Roundcube 0.5 beta.

PHP is properly processed, login works fine but the CSS files are not loaded and Firefox is throwing the following errors:

Error: The stylesheet https://webmail.example.net:10443/roundcube/skins/default/common.css?s=1290600165

was not loaded because its MIME type, "text/html", is not "text/css". Source File: https://webmail.example.net:10443/roundcube/?_task=login Line: 0

Error: The stylesheet https://webmail.example.net:10443/roundcube/skins/default/mail.css?s=1290156319

was not loaded because its MIME type, "text/html", is not "text/css". Source File: https://webmail.example.net:10443/roundcube/?_task=login Line: 0

As far as I understand, nginx doesn't see the .css extension (because ofthe ?s= argument) and thus set the mime type with the default value, being text/html.

Should I fix this in nginx (and how ?) or is it roundcube's related ?

Edit: It seems that it's nginx related. The content-type isn't set for any other type than text/html. I had to include manually the following declarations to force CSS and JS content-types. That's ugly, and I never had the problem before... any idea ?

location ~ \.css {
    add_header  Content-Type    text/css;
}
location ~ \.js {
    add_header  Content-Type    application/x-javascript;
}
share|improve this question
    
Nginx will see the .css extension just fine, most likely you haven't included the mime.types file and thus Nginx does not know any mime types. –  Martin Fjordvald Dec 2 '10 at 20:21
    
not likely... debian default configuration includes the mime.type file in /etc/nginx/nginx.conf as follow: http { include /etc/nginx/mime.types; –  Julien Vehent Dec 2 '10 at 20:44
add comment

1 Answer 1

Same for me, Mime types are correct, but after I used this

location ~ \.css {
    add_header  Content-Type    text/css;
}
location ~ \.js {
    add_header  Content-Type    application/x-javascript;
}

I get a 404 not found error, remove that code, the css shows up fine, but fire fox won't load it due to wrong mime type

I'm on Nginx 0.9.3

FOund the problem! Looks like We we're running everything through PHP Processor Adding this:

if ($uri ~ "\.php"){
fastcgi_pass php-fpm;
}

In the location ~ ^\.php$ { section worked for me! Thanks!

share|improve this answer
add comment

Your Answer

 
discard

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.