Apache: edit to .conf file produces "Invalid command 'Header'"

In order to use Header directive in apache you have to load mod_header module. You can test if module is loaded or not by :-

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 see no output of find command than load that module directly in your apache conf file. Just append below line :-

LoadModule headers_module modules/mod_headers.so

Note :- mod_header is available as base module in apache. So you don't need to install it explicitly.

Issue following command :-

a2enmod headers

Restart web service

apache2ctl restart