Nginx With Gzip On Ubuntu Jaunty

I just noticed that the latest version of Nginx available on Jaunty repositories was [1] the latest legacy version (0.6.x) instead of the latest stable version (0.7.x), and [2] not compiled with gzip compression enabled.

To solve both problems, I had to compile Nginx from source with --with-http_gzip_static_module option. By default, Nginx would be installed at /usr/local. I would rather keep the locations consistent with those used in the precompiled packages from the repositories, so I ended up having to use the following configure options:

./configure 
--prefix=/usr 
--conf-path=/etc/nginx/nginx.conf 
--error-log-path=/var/log/nginx/error.log 
--pid-path=/var/run/nginx.pid 
--lock-path=/var/lock/nginx.lock 
--http-log-path=/var/log/nginx/access.log 
--with-http_dav_module 
--http-client-body-temp-path=/var/lib/nginx/body 
--with-http_ssl_module 
--http-proxy-temp-path=/var/lib/nginx/proxy 
--with-http_stub_status_module 
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi 
--with-debug 
--with-http_flv_module 
--with-http_gzip_static_module
make
sudo make install
nginx path prefix: "/usr"
nginx binary file: "/usr/sbin/nginx"
nginx configuration prefix: "/etc/nginx"
nginx configuration file: "/etc/nginx/nginx.conf"
nginx pid file: "/var/run/nginx.pid"
nginx error log file: "/var/log/nginx/error.log"
nginx http access log file: "/var/log/nginx/access.log"
nginx http client request body temporary files: "/var/lib/nginx/body"
nginx http proxy temporary files: "/var/lib/nginx/proxy"
nginx http fastcgi temporary files: "/var/lib/nginx/fastcgi"

And voila.

foo> nginx -v
nginx version: nginx/0.7.67

The gzip settings in my nginx.conf:

    gzip  on;
    gzip_http_version 1.1;
    gzip_vary on;
    gzip_comp_level 6;
    gzip_proxied any;
    gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
    gzip_buffers 16 8k;
Share Comments
comments powered by Disqus