简体   繁体   中英

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...

Ok, found out! I needed also chmod o+x /home/some-user (parent folder to my site folder)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM