0

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

4 Answers 4

0

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.

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

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.

1
  • Is the problem that the envvars have the user "www-data", while the permissions are for the www-user?
    – user10608
    Aug 22, 2009 at 23:17
0

Try checking your Apache error.log.

1
  • +1, now we know the error is in the configurations.
    – user10608
    Aug 23, 2009 at 4:13
-1

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

<Directory />
  Options FollowSymLinks
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>
1
  • 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. Aug 23, 2009 at 5:38

You must log in to answer this question.