Results 1 to 2 of 2

Thread: Nginx: can't get gzip to work

  1. #1
    Join Date
    Nov 2004

    Nginx: can't get gzip to work


    I have an Nginx server reverse-proxying an apache instance. Nginx is configured to serve static stuff like javascript, css and images. It would be cool if Nginx would gzip the static text files, but it doesn't. My nginx.conf looks like this:

    user www-data;
    worker_processes  1;
    error_log  /var/log/nginx/error.log;
    pid        /var/run/;
    events {
        worker_connections  1024;
    http {
        include       /etc/nginx/mime.types;
        default_type  application/octet-stream;
        access_log  /var/log/nginx/access.log;
        sendfile        on;
        #tcp_nopush     on;
        #keepalive_timeout  0;
        keepalive_timeout  65;
        tcp_nodelay        on;
        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;
        gzip_disable “MSIE [1-6].(?!.*SV1)”;
        include /etc/nginx/sites-enabled/*;
    And the site-specific stuff:
    server {
        listen   80;
        client_max_body_size 20000;
        location ^~ /media/ {
            root   /home/www/soemibar;
        location /gallery/plog-content/ {
            root /home/www/soemibar/public_html;
        location / {
            proxy_redirect  off;
            proxy_set_header    Host        $host;
            proxy_set_header    X-Real-IP   $remote_addr;
            proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /var/www/nginx-default;
    E.g. should be gzipped, but it isn't. I tried it with the Nginx versions from hardy and intrepid, both deliver the content without gzipping it. What am I doing wrong?


  2. #2
    Join Date
    Feb 2008

    Re: Nginx: can't get gzip to work

    Nginx was not compiled with the --with-http_gzip_static_module option. Compile it yourself or use a PPA. See the webpage below for details.

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts