35

I am trying to enable the module "headers" into my apache2 installation on ubuntu 10.04 system, here's some info:

Server version: Apache/2.2.14 (Ubuntu)

When I run the command:

a2enmod headers

I get this output:

ERROR: Module headers does not exist!

but under /usr/lib/apache2/modules/ I can see there is mod_headers.so.

Any suggestion?

EDIT: There is something wrong with my modules, when I access to the webmin's apache modules list it list me just some modules, not every module I can find on /usr/lib/apache2/modules/ For example: I can't see mod_rewrite from the list but I have it in the /usr/lib/apache2/modules/

Paul
  • 3,037
  • 6
  • 27
  • 40
0wn3r
  • 866
  • 1
  • 8
  • 21
  • 3
    Does it list headers if you just run "a2enmod"? – pauska Jan 09 '13 at 09:27
  • Yes but just few of them, here's the list: alias auth_basic authn_file authz_default authz_groupfile authz_host authz_user autoindex cgid deflate dir env mime negotiation proxy proxy_ftp proxy_html proxy_http reqtimeout setenvif ssl status – 0wn3r Jan 09 '13 at 09:28
  • sounds like you've already enabled headers. Does it show if you run "a2dismod"? – pauska Jan 09 '13 at 09:31
  • nope, here's the list it gives me: alias auth_basic authn_file authz_default authz_groupfile authz_host authz_user autoindex cgid deflate dir env mime negotiation proxy_html reqtimeout setenvif ssl status. There is something strange with the modules handlers, I can see a lot of modules into the apache library folder but I can't activate lot of them, is there a way to rebuild the index of the apache modules handler? – 0wn3r Jan 09 '13 at 09:32
  • I solved this, I copied the file headers.load found in the /etc/apache2/mods-available from another apache server installation that I have on another server and then running a2enmod headers activate the module. Now the question is why am I missing some modules files into the /etc/apache2/mods-available? and how to repair this? – 0wn3r Jan 09 '13 at 09:41
  • I just got the same error here, and it seems was just a typo. Be sure you have entered the **plural** form: `sudo a2enmod headers` – Daniel Santos Aug 24 '18 at 23:18

2 Answers2

7

I found a solution which worked for me

Add this line to /etc/apache2/httpd.conf:

LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so

a2enmod headers

service apache2 restart
 * Restarting web server apache2                                                                                                                               [Fri Sep 11 17:04:33 2015] [warn] module headers_module is already loaded, skipping
 ... waiting [Fri Sep 11 17:04:35 2015] [warn] module headers_module is already loaded, skipping
                                                                                                                                                   [ OK ]

After the restart I could delete the LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so from from /etc/apache2/httpd.conf and it's further working!

GregL
  • 9,370
  • 2
  • 25
  • 36
user310818
  • 71
  • 1
  • 1
6

It seems like someone has deleted the include files for certain mods, instead of removing symlinks like the a2enmod/a2dismod tools do.

Reinstall the apache common files to get these files back in place:

aptitude reinstall apache2.2-common

pauska
  • 19,620
  • 5
  • 57
  • 75
  • Thanks dude, but If I run that command I will lose any configuration files or something? – 0wn3r Jan 09 '13 at 10:01
  • No, they are common files, so unless you have edited those then you're safe. Install apt-file and run `apt-file list apache2.2-common` if you want to see what kind of files that package installs. – pauska Jan 09 '13 at 11:21