Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

[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?


-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] client denied by server configuration: /var/www/codes/index.html 
[Sun Aug 23 06:50:31 2009] [error] [client] client denied by server configuration: /var/www/index.html


$ sudo service apache2 start
 * Starting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using for ServerName
share|improve this question
up vote 0 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 /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all

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.

share|improve this answer – user10608 Aug 23 '09 at 5:18
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! – user10608 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

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.

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

Try checking your Apache error.log.

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

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

<Directory />
  Options FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
share|improve this answer
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

Your Answer


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