lighttpd forum lighty > Compiling lighty with Feature GZip enabled

Posted by jenjon (Guest)
on 19.06.2007 19:16
Hello,

I compiled my lighty bin with
./configure --prefix=/usr/local/lighttpd --disable-ipv6 --with-gzip

Feature List at the end of configure output looks like this
enabled:
  auth-crypt
  large-files
disabled:
  auth-ldap
  compress-bzip2
  compress-deflate
  compress-gzip
  network-ip
...

Unfortunately compess-gzip seems to be disabled.
lighttpd.conf includes following statements concerning compression:

server.modules = 
("mod_access","mod_accesslog","mod_status","mod_compress" )
compress.cache-dir         = "/tmp/lighttpd/cache/compress/"
compress.filetype          = ("text/plain", "text/html", 
"text/javascript", "text/css")

mod_status at /server-config outputs "Loaded Modules -> ...compress..."
So mod_compress seems to be loaded successfully.
The cache dir /tmp/lighttpd/cache/compress has according chown settings 
but contains not an single file.
libbz2-1.0 and zlib1g are both installed on the machine.
I expect a configure parameter like --enable-gzip to miss but do not 
know the correct one. Who can help?
Posted by Olaf van der Spek
on 19.06.2007 19:37
jenjon wrote:
> mod_status at /server-config outputs "Loaded Modules -> ...compress..."
> So mod_compress seems to be loaded successfully.
> The cache dir /tmp/lighttpd/cache/compress has according chown settings 
> but contains not an single file.
> libbz2-1.0 and zlib1g are both installed on the machine.

Have you also installed zlib1g-dev (which includes zlib.h)?
Posted by jenjon (Guest)
on 19.06.2007 21:58
Okay, after installing zlib1g-dev successfully, ./configure output is

enabled:
  auth-crypt
  compress-deflate
  compress-gzip
  large-files
  network-ipv6

As recently written, my conf includes following parameters
server.modules =
("mod_access","mod_accesslog","mod_status","mod_compress" )
compress.cache-dir         = "/tmp/lighttpd/cache/compress/"
compress.filetype          = ("text/plain", "text/html",
"text/javascript", "text/css")

Unfortunately those defined files are not sent the compressed way.
Cache dir (/tmp/lighttpd/cache/compress) exists and is chowned by 
lighttpd.lighttpd whitch should be sufficient, shouldn't it?
Does anyone have an idea?
Posted by Olaf van der Spek
on 19.06.2007 22:05
jenjon wrote:
> compress.cache-dir         = "/tmp/lighttpd/cache/compress/"
> compress.filetype          = ("text/plain", "text/html",
> "text/javascript", "text/css")

Isn't it application/x-javascript?
Maybe try without the cache-dir, it's not required.

> Unfortunately those defined files are not sent the compressed way.
> Cache dir (/tmp/lighttpd/cache/compress) exists and is chowned by 
> lighttpd.lighttpd whitch should be sufficient, shouldn't it?
> Does anyone have an idea?

What does the error log say?
Did you restart the web server? :)
Is it a public server so others can test? What's the URL?
Posted by jenjon (Guest)
on 19.06.2007 22:28
Hi Olaf,
> Isn't it application/x-javascript?
Respsonse Header says:
  Content-Type: text/javascript
But also tried with a text/html file without success.

> Maybe try without the cache-dir, it's not required.
Just disabled, without success.

> What does the error log say?
...
2007-06-19 23:49:34: (log.c.135) server stopped
2007-06-19 23:50:40: (log.c.75) server started
2007-06-20 00:16:58: (log.c.135) server stopped
2007-06-20 00:17:04: (log.c.75) server started

> Did you restart the web server? :)
;) Yes, several times.

> Is it a public server so others can test? What's the URL?
http://213.239.209.12/
Posted by Olaf van der Spek
on 20.06.2007 07:06
jenjon wrote:
>> Is it a public server so others can test? What's the URL?
> http://213.239.209.12/

Files smaller than 128 bytes aren't compressed. Got a bigger file?
Posted by jenjon (Guest)
on 20.06.2007 07:42
Posted by Olaf van der Spek
on 20.06.2007 11:31
jenjon wrote:
> okay, try
> http://213.239.209.12/dummy.html

You're right. :(
I do see the "Vary: Accept-Encoding" header which is usually only used
if compression is enabled but I've no idea why the compression itself
isn't working.

Which version are we talking about BTW?
Posted by jenjon (Guest)
on 20.06.2007 20:39
Olaf van der Spek wrote:
> Which version are we talking about BTW?
lighttpd-1.4.15
Posted by jenjon (Guest)
on 20.06.2007 21:37
okay, used the debian package from 
http://packages.debian.org/unstable/web/lighttpd and compression now 
works fine!
Thank you olaf at all.
Posted by manpaz (Guest)
on 04.03.2008 08:43
Anyways, based on Lighttpd documentation you should take care with the 
following statement:

"Keep in mind that compressed JavaScript and CSS files are broken in 
some browsers. Not setting any filetypes will result in no files being 
compressed."

You can see it at:
http://trac.lighttpd.net/trac/wiki/Docs:ModCompress

   Thanks,

      Manuel


jenjon wrote:
> okay, used the debian package from 
> http://packages.debian.org/unstable/web/lighttpd and compression now 
> works fine!
> Thank you olaf at all.