Soft link to external drive not visible in apache directory listing

5,006

Apache won't follow symbolic links unless you specify the FollowSymLinks option in the config file, but I really don't like symlinking out of the web space. Once you allow them, then you've got a potential security risk, if a link is created then it could serve out some sensitive information.

The right way to do this is to add an alias into the apache configuration. Create a file in /etc/apache2/conf.d with contents something like this

Alias /video/ "/home/aakash/Videos"
<Directory "/home/aakash/Videos/">
        Options Indexes MultiViews
        AllowOverride None
</Directory>

This will mean that http://example.com/video will be served from your Videos directory.

Share:
5,006

Related videos on Youtube

Community
Author by

Community

Updated on September 18, 2022

Comments

  • Community
    Community almost 2 years

    I am on Ubuntu 8.10, and generally share my content with ppl on LAN by creating soft links in Apache2 document root to the intended directory. So if I want to share my Videos directory I will

    1. CD /var/www

    2. ln -s ~/Videos/ video

      Then http:/// would list video directory to other users.

    I am facing problem when I try the same thing for my external USB drive. The link gets created fine. From command line I can use the link just like other links, but apache does not show this directory on browser. I have checked the ownership and privileges. They are all fine.