up vote 0 down vote favorite
share [g+] share [fb]

[Solution] Removal of the .htaccess file in /var/www/.

Apache2, php5, Ubuntu- restarted, no firewall, but server not working. The access to http://IP/dir/index.html ignites the "Forbidden" message. Why do I get the error message?

Permissions

-rwxr-xr-x 1 root www 8643 2009-08-22 22:30 style.css
drwxr-sr-x 3 root www 4096 2009-08-22 22:30 views

error log

[Sun Aug 23 06:50:27 2009] [error] [client 212.246.212.212] client denied by server configuration: /var/www/codes/index.html 
[Sun Aug 23 06:50:31 2009] [error] [client 212.246.212.212] client denied by server configuration: /var/www/index.html

error

$ sudo service apache2 start
 * Starting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
   ...done.
link|improve this question

feedback

4 Answers

up vote 1 down vote accepted

The default config in /etc/apache2/sites-enabled/000-default should contain something like

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

Without the the relevant <directory> settings apache won't serve files from the directory. Check you haven't changed this, and if you have, please post what you have in 000-default.

link|improve this answer
pastebin.com/m27e2c150 – hhh Aug 23 '09 at 5:18
1  
Can you also pastebin apache2.conf? Are there any .htaccess files in /var/www? – theotherreceive Aug 23 '09 at 5:43
Solved! A .htacces file denied traffic in /var/www/. Great thanks! – hhh Aug 23 '09 at 9:10
Yea, I thought that might have been the issue when I spotted saw you had "AllowOverride none" set for /var/www – theotherreceive Aug 23 '09 at 10:38
feedback

Not enough information here really -- what is the config file? what's in the "dir" directory, etc., but it's worth noting that the apache user ("www" in this case, we presume) needs directory read permission on all directories above this one up to the effective root if it is going to be able to find it.

link|improve this answer
Is the problem that the envvars have the user "www-data", while the permissions are for the www-user? – hhh Aug 22 '09 at 23:17
feedback

Try checking your Apache error.log.

link|improve this answer
+1, now we know the error is in the configurations. – hhh Aug 23 '09 at 4:13
feedback

You need to have a Allow/Deny directive for your http root

<Directory />
  Options FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>
link|improve this answer
1  
That / isn't relative to the docroot, it's relative to the filesystem, so it'll allow apache to serve every file on the machine. – theotherreceive Aug 23 '09 at 5:38
feedback

Your Answer

 
or
required, but never shown

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