Apache returns 403 Forbidden for alternative port vhost

Posted by Wesley on Server Fault See other posts from Server Fault or by Wesley
Published on 2012-08-18T01:09:17Z Indexed on 2012/12/05 23:06 UTC
Read the original article Hit count: 212

Filed under:
|
|
|

I'm having an issue getting vhosts to work on Apache 2.2, Debian 6. I have two VirtualHosts, one on port 80 and one on port 8888. The port 80 one has been created automatically by DirectAdmin, the 8888 is a custom one. It's configuration is as follows.

<VirtualHost *:8888 >
    DocumentRoot /home/user/public_html/development
    ServerName www.myserver.nl
    ServerAlias myserver.nl

    <Directory "/home/user/public_html/development">
            Options +Indexes +FollowSymLinks +MultiViews

            AllowOverride All

            Order Allow,deny
            Allow from all
    </Directory>
</VirtualHost>

Of course I also have a

NameVirtualHost *:8888

The port 80 DocumentRoot is /home/user/public_html/production, which is perfectly accessible and works like a charm. The port 8888 docroot of /home/user/public_html/development is 403 forbidden though.

I have compared the permissions for both folders. They seem fine to me.

drwxr-xr-x  2 root root  4096 Aug 17 16:14 development
drwxr-xr-x  4 root root  4096 Aug 18 04:29 production

Also, the index.php file which is supposed to display when accessing through port 8888, located in /development/:

-rwxr-xr-x 1 root root 41 Aug 17 16:14 index.html

I have looked at my error_log and found many of the following entries, only being added to the log file when accessing through port 8888.

[Sat Aug 18 04:35:09 2012] [error] [client 27.32.156.232] Symbolic link not allowed or link target not accessible: /home/user/public_html

/home/user/public_html is a symbolic link that refers to /home/user/domains/mydomain/public_html. The symbolic link has the following permissions:

lrwxrwxrwx 1 admin admin    29 Aug 17 15:56 public_html -> ./domains/mydomain/public_html

I'm at a loss. It seems that everything is readable or executable. I've set the Directory to FollowSymLinks in the httpd.conf file, but that doesn't seem to make a difference. If I change that directory tag to <Directory "/home/admin/public_html"> (so it has FollowSymLinks on that as well) it still does not work.

Any help is greatly appreciated. If I need to post more information, let me know. I'm pretty much a beginner at this stuff.

.. ..

UPDATE: I ended up changing the configuration to directly go to the actual path of the files, avoiding the public_html symlink altogether. That worked. Thanks for the suggestions folks.

DocumentRoot /home/user/domains/mydomain/public_html/development

instead of

DocumentRoot /home/user/public_html/development

© Server Fault or respective owner

Related posts about apache2

Related posts about virtualhost