1

I am running Macports apache2 on Mac OS X 10.5. Whenever I configure a virtual host in the default folder, it works, however when I configure the virtual host in my home directory I get a "403 Forbidden" error.

How do I configure a vhost in my home directory?

Here is the configuration that yields "403 Forbidden" when I access "devel.mysite.com": /opt/local/apache2/conf/extra/httpd-vhosts.conf: DocumentRoot "/opt/local/apache2/htdocs" ServerName * #CustomLog "" common

<VirtualHost *:80>
  #DocumentRoot "/opt/local/apache2/htdocs/mysite"
  DocumentRoot "/Users/myuser/Sites/mysite"
  ServerName devel.mysite.com
</VirtualHost>

The error message in /opt/local/apache2/logs/devel.mysite.com-error_log:

[Sat Apr 17 19:54:49 2010] [error] [client 127.0.0.1] client denied by server configuration: /Users/myuser/Sites/mysite/

When I uncomment the line to make DocumentRoot in /opt/local/apache2/htdocs/mysite, it works: DocumentRoot "/opt/local/apache2/htdocs" ServerName * #CustomLog "" common

<VirtualHost *:80>
  DocumentRoot "/opt/local/apache2/htdocs/mysite"
  #DocumentRoot "/Users/myuser/Sites"
  ServerName devel.mysite.com
</VirtualHost>

I get no errors or warnings when I start apache, and the only thing that is logged on startup is this (in /opt/local/apache/logs/error_log):

[Sat Apr 17 19:56:29 2010] [notice] Digest: generating secret for digest authentication ...
[Sat Apr 17 19:56:29 2010] [notice] Digest: done
[Sat Apr 17 19:56:29 2010] [notice] Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8m DAV/2 configured -- resuming normal operations

A few notes: * The permissions of /Home/myuser/Sites/mysite is 755, owned by myuser, group is staff * Everything else works as expected, until I move the ServerRoot of the vhost to the directory in my home

2 Answers 2

2

Try to put the directory tag, that match the DocumentRoot path like this :

<VirtualHost *:80>
   DocumentRoot /home/user1/htdocs
   ServerName hostname.com
   <Directory /home/user1/htdocs>
       Order allow,deny
       Allow from all
   </Directory>
</VirtualHost>
0
0

Fixed my 403 Forbidden Error. I just upgraded to 10.8 and adding

<Directory /home/user1/htdocs>
     Order allow,deny
     Allow from all
</Directory>

You must log in to answer this question.

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