How to add MIME Type for the Apache webserver?
I added "webm" to /etc/mime.types
, which was picked up by Apache as well:
video/webm webm
The default configuration file for the files being served by your Apache installation is /etc/apache2/sites-enabled/000-default
. It's a good idea to backup the original file before you play around with this file.
#To make a backup of the original config file:
sudo cp /etc/apache2/sites-enabled/000-default /etc/apache2/sites-enabled/000-default.orig
Everytime you edit this file, Apache has to be restarted/reloaded for the changes to take effect - sudo service apache2 restart
(or) sudo service apache2 reload
, whereas changes in .htaccess
do not require Apache to be restarted. As @dobey mentioned, the .htaccess
file goes in the DocumentRoot of the web site.
Take a look at the official documentation on how to enable .htaccess
files.
Excerpt:
To make
.htaccess
files work as expected, you need to edit this file:/etc/apache2/sites-available/default
Look for a section that looks like this:
<Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all # Uncomment this directive is you want to see apache2's # default start page (in /apache2-default) when you go to / #RedirectMatch ^/$ /apache2-default/ </Directory>
You need to modify the line containing AllowOverride None to read AllowOverride All. This tells Apache that it's okay to allow
.htaccess
files to over-ride previous directives. You must reload Apache before this change will have an effect:sudo /etc/init.d/apache2 reload
2009.12.08 note: in the LAMP download about a week ago with Ubuntu 9.10 (Karmic) the default configuration file was
/etc/apache2/sites-available/000-default
and it includedAllowOverride None
under<Directory />
in addition to<Directory /var/www/>
. Also, directories in/www/var/
containing.htaccess
files defaulted to not giving the Apache server read access, resulting in the Apache error(13)Permission denied: /var/www/webapp/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable.
To fix,
$ sudo nautilus
then right click on the directory with the.htacces
s file, select Properties, then select Permissions, and give the user group you log in as at least read permission.See http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride for more info on
AllowOverride
.
The .htaccess
file would be something you create in the DocumentRoot
directory of your web site.