1823384 Members
2605 Online
109654 Solutions
New Discussion юеВ

httpd and MIME types

 
SOLVED
Go to solution
Maaz
Valued Contributor

httpd and MIME types

I only found two MIME types in httpd.conf
1, AddType application/x-compress .Z
2, AddType application/x-gzip .gz .tgz

what about other MIME types ?

It means that apache only send MIME types to the client for those files that have .gz .tgz or .Z ?

Ok I can add other MIME types, but why only two MIME types are provided by-default ?

Regards
Maaz
3 REPLIES 3
Antonio Cardoso_1
Trusted Contributor
Solution

Re: httpd and MIME types

Hi,
mime types are configured in mime.types
file (should be in same directory as httpd.conf -e.g. /etc/apache)

this file is pointed to in httpd.conf:

TypesConfig /etc/apache/mime.types


HTH
antonio.
Steven E. Protter
Exalted Contributor

Re: httpd and MIME types

Shalom Maaz,

These types are provided by default. They help browsing users browsers know what to do with the files when the httpd server delivers the files.

I do believe there are other MIME types provided with apache. You can add your own MIME types as well, though depending on the client browser configuration custom MIME types can be of limited usefulness.

http://httpd.apache.org

Contains more infomration on this issue.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Stuart Browne
Honored Contributor

Re: httpd and MIME types

If you're running a RH based system, you'll already have something like these lines in '/etc/httpd/conf/httpd.conf':

LoadModule mime_magic_module modules/mod_mime_magic.so
#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type. The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#

# MIMEMagicFile /usr/share/magic.mime
MIMEMagicFile conf/magic


Andyou'll also have the file '/etc/httpd/conf/magic' (which is a magic-mime file).

As you've already seen, you can add your own type's to supplement this list.

Please note that Apache works out the MIME type by the content of the file being served up, not just taking the person's word based on the extension.

The 'magic' file is of similar forat as the Magic files used for the 'file' utility, just configured to return MIME types instead of application names.
One long-haired git at your service...