apache2 VirtualHost in Mac OS X home directory
Posted
by aaron
on Super User
See other posts from Super User
or by aaron
Published on 2010-04-18T01:19:30Z
Indexed on
2010/04/18
1:23 UTC
Read the original article
Hit count: 727
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
© Super User or respective owner