↑ ↓ select, Enter open, Esc close

Enable an Apache module and reload the configuration

Caution: This command changes the system. Understand what it does before you run it.

Adjust the values, the command updates live
root@server
a2enmod headers && apache2ctl configtest && systemctl reload apache2

a2enmod creates the required symlinks under /etc/apache2/mods-enabled/, then Apache is reloaded. Chaining with && ensures the reload only happens if the configuration test succeeds. The module name is given without mod_, so rewrite, headers or expires.

Note: On Plesk, toggle modules under Tools & Settings, Apache Web Server instead, so Plesk does not overwrite the setting during the next reconfiguration.

Also searched as

  • enable mod_rewrite debian
  • enable mod_headers apache
  • a2enmod headers
  • turn on apache module ubuntu

Related one-liners

All in Apache

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.