The server-wide apache config attempts to load mod_env and mod_rewrite if they are not already enabled
<IfModule !env_module>
LoadModule env_module modules/mod_env.so
</IfModule>
<IfModule !rewrite_module>
LoadModule rewrite_module modules/mod_rewrite.so
</IfModule>
The relative path is relative to the value of ServerRoot in Apache. If ServerRoot is /usr/lib/apache2/ in Debian, this would work, as it's in there that the libraries lay. However, in Debian, ServerRoot is set as /etc/apache2 in /etc/apache2/apache2.conf. Modules have individual configs in mods-available that do the LoadModule with absolute paths to /usr/lib/apache2/modules
This means that on Apache restart, it seeks /etc/apache2/modules/mod_rewrite.so and Apache fails to restart. mod_rewrite then has to be enabled manually traditionally with a2enmod, at which point this section of the config is ignored and so it works (mod_env is already loaded in Debian and that's why that section does not error out)
If we are going to do this, we are going to have to account for varying ServerRoots somehow.. unsure how really. Or check whether the server is Debian based and if so, specify the absolute path to the modules..
Comments
Comment #1
Anonymous (not verified) commentedI couldn't think of a clean way of handling the difference here in the middle of what gets inserted into the config. I think Debian-based systems should just a2enmod rewrite once-off during installation, so I updated INSTALL.txt to suit.
If you think of a clever way of alternating the LoadModule directives to their absolute paths for Debian based systems (same as /etc/apache2/mods-available/rewrite.load does), please revert and change as necessary. For now, having that extra step in the INSTALL.txt is (in my opinion) better than not at all and breaking the installation on a new system when apache is restarted.