After some playing with debian’s current version of nginx I’ve reached
the conclusion it’s not possible without the gunzip module.
Below is my current test configuration, in short I’m trying to reduce
the server bandwidth by having proxy upstream requests and client
responses gzipped, however I need to rewrite some content in-line.
Is this the best way to go about this or am I over complicating it?
server {
listen 80;
listen [::]:80 default_server ipv6only=on;
server_name localhost;
gzip on;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Accept-Encoding “”;
}
}
server {
listen 127.0.0.1:8000;
server_name site1;
location / {
proxy_pass http://127.0.0.1:8001;
sub_filter foo bar;
sub_filter_once off;
proxy_set_header Accept-Encoding “”;
}
}
server {
listen 127.0.0.1:8001;
server_name site2;
gunzip on;
location / {
proxy_pass http://www.example.org;
proxy_set_header Accept-Encoding gzip;
}
}
nginx -V:
nginx version: nginx/1.3.7
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx
–conf-path=/etc/nginx/nginx.conf
–error-log-path=/var/log/nginx/error.log
–http-client-body-temp-path=/var/lib/nginx/body
–http-fastcgi-temp-path=/var/lib/nginx/fastcgi
–http-log-path=/var/log/nginx/access.log
–http-proxy-temp-path=/var/lib/nginx/proxy
–http-scgi-temp-path=/var/lib/nginx/scgi
–http-uwsgi-temp-path=/var/lib/nginx/uwsgi
–lock-path=/var/lock/nginx.lock
–pid-path=/var/run/nginx.pid
–with-pcre-jit
–with-debug
–with-file-aio
–with-http_addition_module
–with-http_dav_module
–with-http_gunzip_module
–with-http_flv_module
–with-http_geoip_module
–with-http_gzip_static_module
–with-http_image_filter_module
–with-http_mp4_module
–with-http_perl_module
–with-http_random_index_module
–with-http_realip_module
–with-http_secure_link_module
–with-http_stub_status_module
–with-http_ssl_module
–with-http_sub_module
–with-http_xslt_module
–with-ipv6
–with-sha1=/usr/include/openssl
–with-md5=/usr/include/openssl
–with-mail
–with-mail_ssl_module
–add-module=/root/build/nginx-1.3.7/debian/modules/nginx-auth-pam
–add-module=/root/build/nginx-1.3.7/debian/modules/chunkin-nginx-module
–add-module=/root/build/nginx-1.3.7/debian/modules/headers-more-nginx-module
–add-module=/root/build/nginx-1.3.7/debian/modules/nginx-development-kit
–add-module=/root/build/nginx-1.3.7/debian/modules/nginx-echo
–add-module=/root/build/nginx-1.3.7/debian/modules/nginx-push-stream-module
–add-module=/root/build/nginx-1.3.7/debian/modules/nginx-lua
–add-module=/root/build/nginx-1.3.7/debian/modules/nginx-upload-module
–add-module=/root/build/nginx-1.3.7/debian/modules/nginx-upload-progress
–add-module=/root/build/nginx-1.3.7/debian/modules/nginx-upstream-fair
–add-module=/root/build/nginx-1.3.7/debian/modules/nginx-dav-ext-module
–add-module=/root/build/nginx-1.3.7/debian/modules/nginx-syslog
–add-module=/root/build/nginx-1.3.7/debian/modules/nginx-cache-purge