My current job has me working with the lighttpd webserver instead of Apache, which I'm much more familiar with. Today I ran into an interesting quirk that I thought I'd take the time to share since it had me scratching my head for quite awhile.
I discovered, to my dismay, that adding a doctype to my index.php file caused my CSS files not to load in Google Chrome, Mozilla Firefox and Apple Safari. Opera and Internet Explorer 8 would load the CSS files appropriately regardless of the doctype, but much to my dismay, IE would display the site correctly only with the doctype included. Without it, it would subject my site to the absolutely horrendous Microsoft-developed box model, obliterating my beautiful design.
Eventually, I discovered, the problem lay with the server, not my code. Specifically, lighttpd was serving up my CSS files with the wrong mime type.
A mime type is a bit of metadata that gets carried along with information that travels over the internet that tells what kind of information is being sent. The problem was that lighttpd did not have an entry in its configuration file for CSS files. What type of information was it defaulting to, you ask? "text/html". Apparently, Internet Explorer and Opera don't care if your CSS files come through with the wrong mime type, but Chrome, Firefox and Safari do.
Fixing the problem was as simple as finding a file on the server at etc/mime.types.conf and adding this line:
I restarted the server, and problem solved! I've never had this problem with Apache. Likely, Apache comes preconfigured with a mime type for CSS files. Now don't get me wrong. This isn't a rant against lighttpd. I'm glad I got experience with this server. It's very, very lightweight, and hence very useful on certain kinds of hardware.
It was not, however, easy to locate the source of this problem. Google search, which normally turns up a solution to my questions right away, was not so helpful this time around. The big tip-off actually came from when I tried to expand my CSS file under the HTML tab in Firebug. Hopefully, this post will be able to find its way to someone with a similar issue.

