I'm sorry if this is a repeated question, but i have tried all the possible solutions from the other answers...

I just installed apache, php5, ..., the works

I can access http://localhost and get the apache index.html located at /var/www

I did the following:
in sites-available: sudo cp default mydefault
opened it and got this:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    <Directory /var/www>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from ::1/128


So i changed DocumentRoot /var/www to my folder and <Directory /var/www> to my folder. Inside this Directory tag, i changed Allow Override to All and inserted DirectoryIndex index.html index.php

I saved, and ran

sudo chmod 755 /myDirectory  
sudo a2dissite default && sudo a2ensite mydefault 
sudo service apache2 restart 

And still get 403 forbidden when accessing http://localhost

Any help wil be appreciated, thanks

  • I am unsure why but in my system the file is named 00-default in both /etc/apache2/sites-available and /etc/apache2/sites-enabled. The contents of both files should be the same in order to avoid that error. Additionally I suggest you to "sudo apache2ctl stop" and "sudo apache2ctl start" in order to the changes to take effect. Sometimes a reboot fixes this issue. Please let me know if this helps you in order to add it as an answer. – Geppettvs D'Constanzo Mar 4 '12 at 21:29
  • appart from the "00-" there is no difference at all, they are the same because the one in sites-enabled is a symlink to the one in sites-available. I did apache2ctl stop and start, no change – André Alçada Padez Mar 4 '12 at 21:36
  • Post the configuration file you are actually using, not the one you used as a template. check the permissions on the directory and what is in the logs ? – Panther Mar 4 '12 at 21:59
  • 1
    Use 'tail -f /var/log/apache2/error.log' as you load the site to glean the problem. – user8290 Mar 4 '12 at 23:46
  • 1
    the problem was that i had SELinux installed, i think. I reinstalled linux, didn't "encrypt my home folder" and now it works. – André Alçada Padez Mar 5 '12 at 13:52

OP posted

the problem was that i had SELinux installed, i think. I reinstalled linux, didn't "encrypt my home folder" and now it works. – André Alçada Padez Mar 5 '12 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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