I have some media in the directory /mnt/sda1 that I would like to embed in my webpage with root at /var/www.

I tried adding to /etc/apache2/sites-enabled/000-default.conf:

Alias /media/ "/mnt/sda1/"
<Directory "/mnt/sda1/">
    Order allow, deny
    Allow from all
    AllowOverride All

But when I attempt to go to mydomain.net/media/file.html I get a 404 error. Writing "http://mydomain.net/media/video.mp4" as the source for a video in html also does not work.

I've tried writing the path with and without quotes and trailing slashes.

I'm not sure where to go from here. Everything I see online points me to what I've already done. Can anyone help point me in the right direction?

  • What do the apache logs say?
    – Craig
    Jan 28, 2016 at 15:08
  • If I attempt to access mydomain.net/media/video.mp4, error.log says "File does not exist: /var/www/media", This means the Alias is not being applied, right? Jan 28, 2016 at 22:25

2 Answers 2


If the Alias command is set, and applied, but accessing a file is denied by an Directory statement, you'll get an access denied error. 404 - not found, means apache couldn't resolve the HTTP request to a file.

First check the obvious. Did you reload the daemon, when you edited the file.

Check apachectl -S to see if the correct VirtualHost file is being loaded against mydomain.net.
check apachectl -M to be sure that mod_alias is being loaded (if not Alias is meaningless).
check apachectl configtest to be sure that you haven't typo'd a config file

My guess, is that you've not reloaded the file properly, as it looks right otherwise


All aliases in apache 2.4 have to be configured in the /etc/apache2/mods-enabled/alias.conf file they are ignored in the virtual host files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.