Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symlink error 403 with apache

I have a symlink mysite in my /srv/http/ folder pointing to /home/some-user/somefolder. In my /etc/httpd/conf/httpd.conf, according to many thread in this site and other forums all around the Internet, I set the following:

<Directory />
            Options FollowSymLinks
            AllowOverride None    
</Directory>

DocumentRoot "/srv/http"
<Directory "/srv/http">
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
</Directory>

Then I changed permission to 777 recursively to my symlink target folder like this:

chmod 777 -R /home/some-user/some-folder

But if I open my webbrowser and enter http://localhost/mysite/mypage.php I get the following error:

Access forbidden!

You don't have permission to access the requested object. It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.

Error 403

localhost
Apache/2.4.9 (Unix) PHP/5.5.14

I've read many articles saying to do so, but I still can get it working...

like image 379
lviggiani Avatar asked Mar 15 '26 09:03

lviggiani


1 Answers

You should chmod o+x the entire path where apache'd go through. So in your case:

sudo chmod o+x /home/

sudo chmod o+x /home/some-user/

sudo chmod o+x /home/some-user/somefolder
like image 78
andymnc Avatar answered Mar 18 '26 01:03

andymnc



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!