Adding A New Mime Type To Apache Globally

topdog

Verified User
Joined
Jun 22, 2009
Messages
135
Hello,
I am running CentOS 5.4, DirectAdmin 1.35.1, and Apache 2.2.14.
I am attempting to add the mime type and extension .docx (Office 2007 MSWord document format) to Apache, but I don't know where to add it to, so that it can be apart of the system mime types.
 
In /etc/httpd/conf/httpd.conf or whatever config in the extra folder is for mimetypes
 
In /etc/httpd/conf/httpd.conf or whatever config in the extra folder is for mimetypes
I added the mime types I wanted in /etc/httpd/conf/mime.types. do I then copy the mime.types file to extra? The new mime types are not showing up under the system's mime types page.
 
No. As long as httpd.conf has an include line for mime.types file it should load it. Make sure you reload or restart apache after adding it. There is a mime types page? I never saw that before.
 
Adding all the Office 2007 mime types to the mime.types file did the trick. People can now download docx files without issue.
Whenever Apache is upgraded, will that mime.types file get overwritten?
 
It won't get overwritten, unless you do "./build rewrite_confs".

Use the following to update you mime.types:
Code:
wget -O /etc/httpd/conf/mime.types http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
 
@smtalk - I am running custombuild 2.0. In etc/httpd/conf/mime.types I find these (amoung others):

Code:
video/x-flv					flv
application/mp4					mp4s
audio/mp4					mp4a
video/mp4					mp4 mp4v mpg4
audio/webm					weba
video/webm					webm

However when I log into DirectAdmin control panel and look in the list of installed system mime types, those mime types are not listed. Is this a bug?
 
However on one of my other servers, the mime types does exist when I check a domain in DirectAdmin control panel. So why is many mime types missing from server one? Both servers has the correct mime types in etc/httpd/conf/mime.types but in DirectAdmin control panel, on of of the servers, many mime types is missing. Both servers is running CentOS 6.4 64 bit and newest DirectAdmn and Custombuild 2.0.
 
I think I found the bug. In my newest server wich always has run cb 2.0, etc/mime.types contains 1588 lines. However on my older server wich was previously upgraded to cb 2.0, etc/mime.types only contains 294 lines. It must be a bug that Custombuild did not update the file etc/mime.types. Please look into this. I will update that file manually my self now.

Also I notice that in custombuild 2.0 default in directadmin.conf has this line: apachemimetypes=/etc/mime.types
 
Back
Top