Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am not able to connect to localhost it showed me the error:

Forbidden

You don't have permission to access / on this server.
Apache/2.2.22 (Ubuntu) Server at localhost Port 80

I removed apache2:

sudo apt-get remove apache2*

And then I reinstalled it, but it still shows the same error.

Please someone help me, as I am new to Ubuntu I don't know much.

share|improve this question
1  
This needs more context. Why are you connecting to localhost? What are you testing? What commands are you running? –  belacqua Apr 2 '13 at 17:44
    
I am making php pages needed to be run on localhost, thats why I am trying to connect to localhost –  user146306 Apr 2 '13 at 18:28
add comment

3 Answers 3

You have to change the permissions of your web folder

chmod 775 /var/www

You also need to set ownership of the file for your web user.

share|improve this answer
1  
also just realize you're trying to access / folder try adding in an index document otherwise you're just accessing the root directory –  Dylan Dodds Apr 2 '13 at 19:36
add comment

You need to configure the filesystem to be accessable.

In apache config/virtual-host:

# Forbid default access to filesystem locations
<Directory />
    Order Deny,Allow
    Deny from all
</Directory>

# Allow access to filesystem location
<Directory /path-to/whatever/dir/>
    Order Allow,Deny
    Allow from all
</Directory>
share|improve this answer
add comment

Try:

cd var/
chmod 755 www

Check this article too.

If that doesn't work try this:

chmod 755 /var/www/
share|improve this answer
    
none of the commands is working. `/usr/local/apache2/htdocs': No such file or directory –  user146306 Apr 2 '13 at 18:29
    
@Sabeer: /var/www is the canonical preconfigured location for the web root of Apache on Ubuntu/Debian. –  0xC0000022L Apr 2 '13 at 19:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.