5

I have just set up an Apache 2.2 server on a new Linux Mint installation. I am recreating a previous set up I had on an old Ubuntu machine.

On my previous computer, I had to enable FollowSymLinks in httpd.conf, because I store my web site HTML files in my home directory, and link to them from a symbolic link in /var/www.

On my new server, I can't find any httpd.conf anywhere, so I can't seem to set the option to follow symlinks. As a result, I'm getting a 403 Forbidden: You don't have permission to access / on this server error.

Also, in my error log, it says:

[Sun May 05 02:12:17 2013] [error] [client 127.0.0.1] Symbolic link not allowed or link target not accessible: /var/www/Websites

Has something changed in how one allows symlinks? Or am I wrong about the setting being in httpd.conf? In any case, how do I get my new Apache to follow symlinks?


Update: Based on an answer below, I checked in the files /etc/apache2/sites-enabled/000-default and /etc/apache2/sites-available/default, and they both have the FollowSymLinks option. Is there some other reason I might be getting the error mentioned above?

DocumentRoot /var/www
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>
Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
Questioner
  • 1,150
  • 5
  • 21
  • 35

1 Answers1

2

You should look in /etc/apache2/sites-enabled/000-default (which is probably a link to /etc/apache2/sites-available/default).

Anthon
  • 79,293
  • Thank you for responding. In those files, FollowSymLinks seems to be enabled. But I am getting a Symbolic link not allowed or link target not accessible error in my Apache logs (I have updated my question). Is there possibly another reason I am getting this error? – Questioner May 04 '13 at 17:18
  • I must confess I often have to resort to trial-and-error finding solutions for Apache. First I would make sure you can access the directory the link points to, as the user for which apache is running (www-data?), to test you can also link to something like an xyz directory under /tmp with rwxrwxrwx permissions. If that is not it I would then try to remove the AllowOverride None line and make the +FollowSymLinks for /var/www/. – Anthon May 04 '13 at 17:32
  • Thanks for following up. I poked around a bit and found the answer here. I needed to run sudo chmod +x on the directories in my /home folder that contain my HTML files. Seems to be working now. – Questioner May 04 '13 at 17:54
  • That would indeed give the 'apache2-user' access rights to those directories. – Anthon May 04 '13 at 18:12
  • Don't forget to give apache-user access right for those symlinks. For debian and debian derived distros, it's sudo chown -h www-data:www-data <symink>. For Fedora, sudo chown -h apache:apache <symink>. Omit any slash (/) after the symlinks otherwise the ownership change will not take effect (a noob mistake I made). – Meraj al Maksud Dec 09 '23 at 13:08