Mac apache localhost giving 403 Forbidden

apache, httpd.conf, localhost, macos, virtualhost

Solution

I just resolved this issue. Try adding 'Require all granted' instead of 'Allow from all'.

<VirtualHost *:80>
    ServerName test.com
    ServerAlias www.test.com
    DocumentRoot "/Users/[my_name]/Sites/test"

    <Directory "/Users/[my_name]/Sites/test">
            Options Indexes FollowSymLinks Includes ExecCGI
            AllowOverride All
            Require all granted 
    </Directory>
</VirtualHost>

Problem

Im trying to set up my local environment on my new mac OSX 10.9. I know it has apache already installed, so i've been using that. No matter how I set up my httpd-vhosts.conf/hosts/httpd.conf files, I continuously get a 403 forbidden error when visiting localhost OR "test.com" on my browser. The error / files / other information is listed below. This is the error I'm getting when visiting either web page ``` Forbidden You don't have permission to access / on this server. Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request. ``` My /private/etc/hosts file ``` 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost 127.0.0.1 test.com 127.0.0.1 www.test.com ``` My /private/etc/apache2/httpd.conf file ``` This file is in its original form besides the following changes: Uncommented Include /private/etc/apache2/extra/httpd-vhosts.conf ``` My /private/etc/apache2/extra/httpd-vhosts file ``` <VirtualHost *:80> ServerName localhost DocumentRoot /Library/WebServer/Documents/ </VirtualHost> <VirtualHost *:80> ServerName test.com ServerAlias www.test.com DocumentRoot "/Users/[my_name]/Sites/test" <Directory "/Users/[my_name]/Sites/test"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> ``` Other notes - I've created a config file my user account in `/private/etc/apache/users/` - I've given that file read and write permissions to "everyone" - I've restarted apache after every save to any config file - I've reset the cache on my browser every time I make a change to these files - I have an index.html file set up in my `/Users/[my_name]/Sites/test/` folder When using the command `sudo apachectl -t` ``` Warning: DocumentRoot [/usr/\xe2\x80\x9c/Users/joshwoelfel/Sites/test\xe2\x80\x9d] does not exist httpd: Could not reliably determine the server's fully qualified domain name, using Joshs-MacBook-Air.local for ServerName Syntax OK ``` I don't know what to try at this point. I've spent several hours looking at tutorials and other questions people have posted. It looks like my files and permissions are correct!

Original source