After upgrading my entire system, moving from Apache 2.0.x to 2.2.6 I ran into an interesting problem (actually, a couple.) Some of the configurations have moved, and things that used to be in the Gentoo dist httpd.conf have been broken out into config files in the /etc/apache2/modules.d/ directory. So, copying my old vhosts file in was not a good idea. And doing a merge of the old and new httpd.conf files was also a mistake. Once I figured out that I had the Listen 80 directive in one file and Listen 192.168.1.10:80 in another I understood why it failed to start. So, I fixed all the configs to match the new setup, and tried again. It started up just fine, and seemed okay, until I tried to connect. I kept getting 403 errors.
I went through the standard checks, checking the file permissions, .htaccess settings, and so on, to no avail. A quick Google search pointed me to the fix from Victor Trac. He found the offending bit in the new broken out config in /etc/apache2/modules.d/00_default_settings.conf where it contains:
<Directory />
Options FollowSymLinks AllowOverride None Order deny,allow Deny from all </Directory>
The fix is either to change that to Allow from all and define Deny where needed in each virtual host or to override it in every virtual host. Since I tend to set up my hosts with the idea that the server allows everything and it is up to the host to deny where needed I chose the first option, reloaded Apache and everything is sweet again.
Edit:
I found I was having an error with the RewriteRules after switching from Apache 2.0.x to 2.2.x – I found the fix on the Gentoo forums, which required adding an extra RewriteCond line in the .htaccess file.
The old .htaccess: and the new:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /blog RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /blog/index.php [L] </IfModule> # END WordPress
and the new:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /blog RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !\.php$ RewriteRule . /blog/index.php [L] </IfModule> # END WordPress
Technorati Tags: Apache 2.2, 403, Gentoo
Glad I could help. :)
Just wanted to say thanks for the post. This was driving me crazy and fixed my problem.
Hi, I’m running apache 2.2.9-r1 on my Gentoo amd64 and wasted around 4 hours on trying to solve that problem. Fortunately I got here. Thanks alot for that post :)
I got here by accident because typing in google:”apache gentoo forbidden 403″ didnt bring me any valuable results. But I also had a problem with listen directive,which for some reason HAS to be in httpd.conf file, and googling:”listen directive gentoo apache” finally brought me here ;)