Hi,
Has anyone tested it on lighttpd?

Comments

mikeytown2’s picture

Status: Active » Postponed (maintainer needs more info)

AFAIK it hasn't been tested on lighttpd. Here are the rules fully explained.

This tells the browser that all css.gz files are gzipped and adds a mime type of text/css to css.gz files.

  <FilesMatch "\.(css.gz)$">
    AddEncoding x-gzip .gz
    ForceType text/css
  </FilesMatch>

In lighttpd this line (ForceType text/css) would be something like this?

mimetype.assign   = ( ".css.gz"  => "text/css")

I have no idea how to do (AddEncoding x-gzip .gz) after reading the docs.

The next one is the rewrite rules. IF NOT Safari && accepts gzip encoding && yourcssfile.css.gz exists THEN rewrite *.css to *.css.gz.

  RewriteCond %{HTTP_USER_AGENT} !.*Safari.*
  RewriteCond %{HTTP:Accept-encoding} gzip
  RewriteCond %{REQUEST_FILENAME}.gz -f
  RewriteRule ^(.*)\.css $1.css.gz [L,QSA]

In lighttpd the last line would be?

url.rewrite-once = ( "^(.*)\.css" => "$1.css.gz" )

I have no idea how to do conditionals in lighttpd from the docs.


As of right now, lighttpd is unsupported. But if someone comes up with some rules, then I would be willing add it in.

aalemmar’s picture

This module is not need on lighttpd. Reading the documentation, I've put these lines on my lighttpd.conf

server.modules += ( "mod_compress" )
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ("text/css", "text/javascript")

I also created the folder /var/cache/lighttpd/compress and chowned it to the lighttpd user and group as configured on my Arch Linux, for Debian/Ubuntu the user and group ids should both be www-data.

chown http:http /var/cache/lighttpd/compress

Now, every css ou javascript served is compressed and cached on /var/cache/lighttpd/compress, the only con I've found is that lighttpd doesn't exclude old compressed files.

Sorry for my poor English

mikeytown2’s picture

Does the compressed dir have a ba-zillion files in there? Apache will generate a different file for each HTTP_USER_AGENT (from what I hear) so thats why caching it via apache doesn't work so well.

mikeytown2’s picture

Status: Postponed (maintainer needs more info) » Postponed

Due to recent developments with the boost module; I sorta know how lighttpd works. I can use this as a guide
http://groups.drupal.org/node/22787

mikeytown2’s picture

Status: Postponed » Closed (won't fix)

CSS Gzip will no longer be updated/supported. All future development is being done in the Advanced CSS/JS Aggregation module.