On Thu, 31 Aug 2006, Igor Sysoev wrote:
On Thu, 31 Aug 2006, Yusuf Goolamabbas wrote:
Hi, I wasn't able to figure out if it's possible to send out
precompressed (gzipped data) via nginx
It just needs to add Content-Encoding: gzip to the response header
I'm looking for something similar to what can be done in lighttpd
http://trac.lighttpd.net/trac/wiki/Docs%3AModSetEnv
Currently it's easy to do only if you can easy separate locations:
location / {
root /path/to/files;
}
location ~* "(README|ChangeLog|\.txt)\.gz$" {
root /path/to/files;
add_header Content-Encoding gzip;
# turn off on the fly gzip compression, because
# it does not currently check header set by "add_header"
gzip off;
# nginx set type according last suffix only
type { text/plain gz }
}
It could be also done is such way:
location / {
root /path/to/files;
###
location ~* "(README|ChangeLog|\.txt)\.gz$" {
add_header Content-Encoding gzip;
gzip off;
type { text/plain gz; }
}
location ~* "\.html\.gz$" {
add_header Content-Encoding gzip;
gzip off;
type { text/html gz; }
}
###
The text between ### could be include'd from file and used in several
locations.