Last updated on September 21st, 2021 at 10:59 am
mod_headers is a useful Apache module that allows you to control and modify HTTP request and response headers in Apache. If you try to modify headers in Apache web server without installing mod_headers, it may throw an internal server error. Here’s how to enable mod_headers in Apache Ubuntu/Debian. You can also use it to enable mod_headers in Cpanel, WordPress. However, mod_headers is already installed in httpd on Redhat/Fedora/CentOS, by default.
How to Enable mod_headers in Apache Ubuntu
Here’s how to enable mod_headers in Apache Ubuntu / Debian.
1. Install mod_headers
If you want to install Apache module such as mod_headers, you need to issue the a2enmod command
$ sudo a2enmod <module_name>
Open terminal and run the following command.
$ sudo a2enmod headers
Bonus Read : How to Upgrade Apache Version in CentOS, Redhat Linux
2. Restart Apache Web Server
Restart Apache web server for changes to take effect
$ sudo service apache2 restart
Bonus Read : How to Enable Keep Alive in Apache
3. Check if mod_headers is working
You can easily check if mod_headers is enabled by running the following command
$ apachectl -M | headers
OR
$ apache2ctl -M | grep headers
If you see the following output, it means mod_headers is enabled and working.
$ headers_module (shared)
Bonus Read : How to Change Port Number in Apache
4. Disable mod_headers
If you want to disable/uninstall Apache module such as mod_headers, you need to issue the a2dismod command
$ sudo a2dismod <module_name>
To disable/uninstall mod_headers run the following command.
$ sudo a2dismod headers
Restart Apache web server to apply changes.
That’s it! Now you can easily install, enable and disable mod_headers in Apache web server.
Ubiq makes it easy to visualize data in minutes, and monitor in real-time dashboards. Try it Today!
Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI & software development.