localhost shows 403 forbidden in snow leopard mac

In mac, to set up your apache all you have to do is:
Go to terminal and type

sudo apachectl start

– you can get the terminal by going to Application folder and then to utilities and by clicking terminal.

Then go to your browser and type http://localhost.

Now if you get the error 403 forbidden then:
Open /etc/apache2/extra/httpd-vhosts.conf file and make sure you have proper directory setting for example:


    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "/Library/WebServer/Documents"
    ServerName local.com
    ErrorLog "/private/var/log/apache2/local.com-error_log"
    CustomLog "/private/var/log/apache2/local_access_log" common

In the above example, the document root is in Library/WebServer/Documents. Which means if I want to create a website, then the website folder has to be inside that and will be accessd as http://local.com/website

**if you name server as localhost, then you can access it as http://localhost

Finally, check if hosts file has correct ip-servername mapping by looking into the file /etc/hosts
Then reload your apache

sudo apachectl restart

EnJoY!