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

Background :So in an attempt to learn apache, Im following along with the exercises in the book "Apache: The definitive guide". As part of these exercises, we're incrementally building up the httpd.conf file.

Problem: my html is getting served as plaintext. The mime-type is plain\text even though the file extension is .html

I'd like to know what directive i must add for it to pick up the right extension Here's my conf file :

User webuser  
Group webgroup
ServerName my586
DocumentRoot /usr/www/APACHE3/site.first/htdocs
TransferLog logs/access_log
Listen 80

Additional Info to help diagnose the problem:

The exercise also mentions adding the following directive: TypesConfig conf/mime.types

But this gives the following error: Invalid command 'TypesConfig', perhaps misspelled or defined by a module not included in the server configuration this led me to the believe it had something to d with the mod_mime module, but i havent been able to make it work through that either

Update: Interestingly, I presumed, images\jpegs would be shown as plain text too, but it shows them fine, i.e. sets the correct mime type on them.

share|improve this question
    
Is this apache1 or apache2? –  Alex Jurkiewicz Jun 2 '09 at 7:12
    
this is apache2 –  user7420 Jun 2 '09 at 7:26
    
So I elimintaed the posibilit of this having anything to do with the mod_mime. I made the TypesConfig directive work by adding the following directive : #Include /etc/apache2/mods-enabled/*.load #Include /etc/apache2/mods-enabled/*.conf But the original problem of .html extensions displaying as plaintext still remains. From what I can gather, apache is supposed to behave this way by default (change mime-type based on extension) –  user7420 Jun 2 '09 at 7:29
    
Lines starting with a "#" are ignored. The "#" signifies the start of a comment. If you added lines starting with that they won't do anything :) –  Alex Jurkiewicz Jun 2 '09 at 7:53
    
oops, the #'s were not intended. (looks like i miss my c\c++ days of #includes) –  user7420 Jun 2 '09 at 7:59

2 Answers 2

AddType image/gif .gif 

It seems that if you want TypesConfig to work, you will need to make sure you have mod_mime loaded.

share|improve this answer

On linux distributions, you have a file /etc/mime.types which contains mime type definitions. It is loaded with the command TypesConfig after the load of the mime module :

LoadModule mime_module /usr/lib/apache2/modules/mod_mime.so
<IfModule mod_mime.c>
TypesConfig /etc/mime.types
</IfModule>

Inside the IfModule, you can also add charset and language declarations.

share|improve this answer

Your Answer

 
discard

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