In ubuntu, i am running simple html page that can run mp4 video, i have configured Apache Server and have run simple test page for hello world, its working fine. In Apache Webserver i have read that we need to add the following code to httpd.conf file or to an .htaccess file in the directory where our video files are.
AddType video/ogg .ogv AddType video/mp4 .mp4 AddType video/webm .webm
So my question is where is this httpd.conf or .htaccess file available, do i manually need to create these files or they are stored somewhere.
The code of my HTML Page is like this :
<video width="320" height="240" controls> <source src="test.mp4" type="video/mp4"> <source src="test.ogg" type="video/ogg"> </video>
Please give me the suggestions.
Ankit
33 Answers
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.origEverytime 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
.htaccessfiles work as expected, you need to edit this file:/etc/apache2/sites-available/defaultLook 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
.htaccessfiles to over-ride previous directives. You must reload Apache before this change will have an effect:sudo /etc/init.d/apache2 reload2009.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-defaultand it includedAllowOverride Noneunder<Directory />in addition to<Directory /var/www/>. Also, directories in/www/var/containing.htaccessfiles 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 nautilusthen right click on the directory with the.htaccess file, select Properties, then select Permissions, and give the user group you log in as at least read permission.See for more info on
AllowOverride.
The .htaccess file would be something you create in the DocumentRoot directory of your web site.