To use the header directive in apache, you need to load the mod_header module. You can check if the module is loaded or not: -
apache2ctl -M | grep headers_module
find / -name mod_headers.so
If it is loaded, you will see something like: -
headers_module (shared)
/usr/lib/apache2/modules/mod_headers.so
If you do not see the output of the find command, rather than loading this module directly into the apache conf file. Just add the line below: -
LoadModule headers_module modules/mod_headers.so
Note. - mod_header is available as a base module in apache. Therefore you do not need to explicitly install it.
Run the following command: -
a2enmod headers
Restart web service
apache2ctl restart
Siddharth sharma
source share