I’ve been maintaining and managing Apache servers for over 10 years now, but for some reason, I never bothered to RTFM when it came to enabling/disabling modules and site configs in apache2.. As it turns out, you don’t have to manually create symlinks from mods_available to mods_enabled and sites_available to sites_enabled, as Apache2 includes a handful of shortcut scripts to do this work for you… Doh!
To enable a module in your apache2 config, instead of doing the old
ln -sf /etc/apache2/mods_available/mod_rewrite.conf /etc/apache2/mods_enabled/mod_rewrite.conf ln -sf /etc/apache2/mods_available/mod_rewrite.load /etc/apache2/mods_enabled/mod_rewrite.load |
Next time, just do:
a2enmod rewrite && /etc/init.d/apache2 restart |
To disable this module, try
a2dismod rewrite && /etc/init.d/apache2 restart |
Similarly, to enable a site config, try
a2ensite myVhost.com && /etc/init.d/apache2 restart |
and to disable it, obviously, try
a2dissite myVhost.com && /etc/init.d/apache2 restart |
Finally, if you’d like to lint through your Apache2 config files before issuing a restart which might be responsible for some downtime if it doesn’t work, try
apache2ctl configtest |