5

I Installed Apache2. In the the folder "var/www/html" I created a symlink to a different HDD that holds a number of movie files. My thinking is that it would be easy to access the movies through a browser from any computer on my local network.

I used the following command string while in the html directory, and created the symlink:

ln -sd /media/guy/movie1/Movies test

While sitting at the server if I click on "test" it opens the correct directory and exposes the files. If I surf to apache from another machine it does not show the symlink.

Excerpt from Apache access log:

192.168.1.158 - - [12/May/2015:08:40:07 -0400] "GET /favicon.ico HTTP/1.1" 404 502 "-" "Mozilla/5.0 (X11; Linux i686; rv:24.7) Gecko/20140802 Firefox/24.7 PaleMoon/24.7.1"
192.168.1.158 - - [12/May/2015:08:40:07 -0400] "GET /favicon.ico HTTP/1.1" 404 502 "-" "Mozilla/5.0 (X11; Linux i686; rv:24.7) Gecko/20140802 Firefox/24.7 PaleMoon/24.7.1"
192.168.1.158 - - [12/May/2015:08:40:07 -0400] "GET /favicon.ico HTTP/1.1" 404 502 "-" "Mozilla/5.0 (X11; Linux i686; rv:24.7) Gecko/20140802 Firefox/24.7 PaleMoon/24.7.1"
192.168.1.158 - - [12/May/2015:08:50:38 -0400] "GET / HTTP/1.1" 200 584 "-" "Mozilla/5.0 (X11; Linux i686; rv:24.7) Gecko/20140802 Firefox/24.7 PaleMoon/24.7.1"
192.168.1.158 - - [12/May/2015:08:50:39 -0400] "GET /icons/blank.gif HTTP/1.1" 304 178 "http://192.168.1.178/" "Mozilla/5.0 (X11; Linux i686; rv:24.7) Gecko/20140802 Firefox/24.7 PaleMoon/24.7.1"
3
  • The log entries you added are normal. Are you saying things are still not working for you? May 12, 2015 at 13:58
  • Yes, does not work May 12, 2015 at 17:34
  • You mention that I ensure all the permissions are correct, including the parents. I am not sure how to determine that they are correct , I am quite new to this. I created a new symlink since making the changes you described. Here is the ouput of the ls -l command lrwxrwxrwx 1 root root 24 May 12 08:27 new_link -> /media/guy/movie1/Movies lrwxrwxrwx 1 root root 24 May 11 19:56 test -> /media/guy/movie1/Movies May 12, 2015 at 17:37

1 Answer 1

5

A symlink should work fine. You may or may not need to add the directory to /etc/apache2/apache2.conf so that apache knows it is allowed to access the non-standard directory.

Example (note: I do not use the -d option):

doug@s15:/var/www/html$ ln -s /media/newhd/test_web bla2
doug@s15:/var/www/html$ ls -l
total 44
...
lrwxrwxrwx 1 doug doug   21 May 11 22:14 bla2 -> /media/newhd/test_web
...

Excerpt from '/etc/apache2/acpahe2.conf'

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

<Directory /media/newhd/test_web/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

Make sure all permissions, including parents, are in order. You can do it manually, directory by directory or:

$ namei -m /media/newhd/test_web
f: /media/newhd/test_web
 drwxr-xr-x /
 drwsrwsrwt media
 drwxr-xr-x newhd
 drwxr-xr-x test_web

Now, there are some files systems that do not work with Apache, my example was an ext4 filesystem. And some disks that are automounted (mine is not) need an fstab entry to work properly.

Otherwise help us to help you with a little more information, such as any /var/log/apache2/*.log entries.

4
  • My problem is permissions but I am unable to change them using chmod. The HDD is NTFS f: /media/guy/movie1/Movies drwxr-xr-x / drwxr-xr-x media drwxr-x--- guy drwxrwx--- movie1 drwxrwx--- Movies May 13, 2015 at 13:47
  • Yes, NTFS is probably the problem. My understanding, which might be wrong, is that NTFS doesn't conform well enough to POSIX standards. May 13, 2015 at 14:48
  • Have a look at this. May 13, 2015 at 15:03
  • @GuyD'Amico what if you install cygwin and use chmod there? cd /cygdrive/f/ then chmod ...
    – barlop
    Jul 28, 2022 at 18:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .