I upgraded my server’s apache from 2.0 to 2.2 today (see Overview of new features in Apache 2.2) and it was painless except for a few minor hiccups. I like to keep my server’s packages up to date with Gentoo’s stable packages not just for new features but mainly to make package upgrades as easy as possible. I find that by staying up to date with upstream stable packages, upgrades are more incremental and rarely cause as much difficulty as having to upgrade from multiple major versions behind.
With Gentoo, the Apache 2.2 upgrade came with a routine:
emerge –sync emerge -uDav worldI noticed the new Apache version, checked out the other packages listed, and then hit enter to proceed. At the end of the compilation, Gentoo reminded me there are new config files in /etc to merge. Luckily for me, I’ve maintained a clean separation of Apache configuration directives and VirtualHosts, so I was able to accept all of the major configuration directive changes without modification (2.2 mostly just moves around the default directives to more logical locations). Staying up to date and close to upstream shows its benefits here.
Apache restarted without complaining, but attempts to access any of my virtualhosts resulted in a 403 Forbidden:
[Sat Sep 08 13:30:55 2007] [error] [client 188.8.131.52] client denied by server configuration: /home/victor/public_html/This was caused by Apache 2.2’s /etc/apache2/modules.d/00_default_settings.conf:
<Directory /> Options FollowSymLinks AllowOverride None Order deny,allow Deny from all </Directory>You can either override this manually in every vhost.d/*.conf file, or you can just change the “Deny from all” line to “Allow from all” and then make Deny rules manually in each vhost.d file (if you wish). I restarted apache and refreshed my test site, but there was now a new problem - .php files were being parsed as plain text, which meant Apache wasn’t passing off .php files for processing.
I added “-D PHP5” to my /etc/conf.d/apache2’s APACHE2_OPTS line, which tells Apache to load the PHP5 module. However, since my libphp5.so was built for my old Apache, I had to re-compile for Apache 2.2:
emerge -av phpI waited a few minutes, restarted apache, and now everything works beautifully.