Apache 2.4 Upgrade on Debian
After spending an hour or so on getting my old configuration to work with the Apache 2.4 package from Debian I decided to share my experiences in a little how to. There are changes both from upstream and in the Debian packaging. IMO it has all changed for the better, but it was quite annoying to get everything to work. So, here’s my how-to:
Step 1. Read Debian’s summary of the most important changes:
Step 2. Move your configuration. In Debian’s customized version of Apache 2.2 the user-made configuration was supposed to be stored in /etc/apache2/conf.d. This directory is no longer read. Instead, /etc/apache2/conf-available should be used, and the configuration should enabled with the a2enconf command (analoguous to the site* and mod* commands and directories). Also note that all the configuration files must end with “.conf” in 2.4.
Step 3. Rename and enable your VHosts. Check that your VHosts got renamed to end with “.conf”, if not then rename them. You’ll also have to re-enable them with a2ensite.
Step 4. Try to start Apache. You’ll likely have problems with configuration directives that are not recognized. This happens for two reasons: First, the upgrade process disables a lot of modules, and second some directives have been changed in Apache 2.4. For example:
Allow and Deny are deprecated and not available by default. You should use the Requires and <RequireAny>, <RequireAll> and <RequireNone> directives instead.
New rules for how + can be used in Options directives.
Some modules got disabled during the update (I have no idea why):alias
The default policy is to deny access in all directories except for /var/www and /usr/share (this is a change from Debian I think). So you must enable each directory you want to use with Require directives.
Hopefully, after some restarting and fixing stuff you will get Apache running again :)