localhost shows 403 forbidden in snow leopard mac

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!

See how you would solve these known algorithm problems

Implementing tokenizer and adding tokens to the linked list

Implement Queue Using two Stacks – JavaScript algorithm

find longest word in the sentence

Get maximum occurring character

Kadane’s algorithm in C – Dynamic Programming

Find longest palindrom from sequence of characters

Array reversal in Recurrsion

Check if two strings are anagrams or not

Finding missing numbers from billion sequential number list file

testing k complementary pairs algorithm with junit

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*