Fix “Invalid command ‘Header’, perhaps misspelled or defined by a module not included in the server configuration” on Debian Squeeze Apache 2.2

Wednesday, 12th May 2010

I am enabling http gzipping on Apache 2.2.9-10+lenny7 I included the following Apache directives in my /etc/apache2/apache2.conf

<Location />
# Insert filter
SetOutputFilter DEFLATE

# Netscape 4.x has some problems…BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
# BrowserMatch bMSIE !no-gzip !gzip-only-text/html

# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won’t work. You can use the following
# workaround to get the desired effect:
BrowserMatch bMSI[E] !no-gzip !gzip-only-text/html

# Don’t compress images
SetEnvIfNoCase Request_URI
.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don’t deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</Location>

Then I tried restsarting the Apache Webserver:

debian-server:~# /etc/init.d/apache2 restart
Syntax error on line 56 of /etc/apache2/apache2.conf:

and I ended up with the following error:

Invalid command ‘Header’, perhaps misspelled or defined by a module not included in the server configuration

A quick look through my Apache module configurations and consultation with Google shown I’m missing the mod_deflate module along my Apache server loaded modules.

To enable the module to resolve the error issue:

Invalid command ‘Header’, perhaps misspelled or defined by a module not included in the server configuration all I did was:

debian-server:~# ln -sf /etc/apache2/mods-available/headers.load /etc/apache2/mods-enabled/headers.load

Then I restarted the Apache:

debian-server:~# /etc/init.d/apache2 restart

Hooray now html content passed from the Apache webserver to the end users is transferred in a gzip format ! 🙂

Share this on:

Download PDFDownload PDF

Tags: ,

8 Responses to “Fix “Invalid command ‘Header’, perhaps misspelled or defined by a module not included in the server configuration” on Debian Squeeze Apache 2.2”

  1. Fuscata says:
    Firefox 3.6.3 Firefox 3.6.3 Ubuntu 10.04 Ubuntu 10.04
    Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3 (.NET CLR 3.5.30729)

    Rather than creating the links yourself, you can use a2enmod:
    sudo a2enmod headers
    sudo apache2ctl graceful

    View CommentView Comment
    • admin says:
      Epiphany 2.29.92 Epiphany 2.29.92 Debian GNU/Linux x64 Debian GNU/Linux x64
      Mozilla/5.0 (X11; U; Linux x86_64; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.29.92

      Thanks, I know that but actually I prefer linking them manually 🙂

      View CommentView Comment
  2. netking17 says:
    Firefox 3.6.10 Firefox 3.6.10 Mac OS X 10.6 Mac OS X 10.6
    Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; fr; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10

    saved my life, thanks !!!

    View CommentView Comment
  3. Tilo says:
    Firefox 3.6.13 Firefox 3.6.13 Mac OS X 10.6 Mac OS X 10.6
    Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13

    Thats great, its work well…

    I fixit the problem with mod_rewrite. i wanted to output whitout the fragment index.php in seo-url-friendly.

    The error 500 looks than…this tutorial fixed the problem.

    View CommentView Comment
    • admin says:
      Epiphany 2.30.6 Epiphany 2.30.6 Debian GNU/Linux x64 Debian GNU/Linux x64
      Mozilla/5.0 (X11; U; Linux x86_64; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/5.0 Safari/531.2+ Debian/squeeze (2.30.6-1) Epiphany/2.30.6

      Thanks Tilo,

      I’m happy I was able to help to somebody out there.

      Best!
      Georgi

      View CommentView Comment
  4. Lei says:
    Google Chrome 11.0.696.71 Google Chrome 11.0.696.71 Windows 7 Windows 7
    Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.71 Safari/534.24

    it works
    thank you very much for the brilliant work:)

    View CommentView Comment
    • admin says:
      Epiphany 2.30.6 Epiphany 2.30.6 Debian GNU/Linux x64 Debian GNU/Linux x64
      Mozilla/5.0 (X11; U; Linux x86_64; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/5.0 Safari/531.2+ Debian/squeeze (2.30.6-1) Epiphany/2.30.6

      you’re welcome 🙂

      View CommentView Comment
  5. Ben says:
    Firefox 6.0.2 Firefox 6.0.2 Windows 7 x64 Edition Windows 7 x64 Edition
    Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20100101 Firefox/6.0.2

    In my experience, this message does not result from a missing mod_deflate module; it results from a missing mod_headers module.

    For those of you who continue to receive this message after enabling mod_deflate, try enabling mod_headers.

    See: http://littletechthoughts.blogspot.com/2009/02/invalid-command-header-perhaps.html

    View CommentView Comment

Leave a Reply

CommentLuv badge