0

After trying anything I could, the gzip compression in my nginx is still not working.

environment:

  • Ubuntu 11.04 with nginx ppa, with the latest release (1.0.8)
  • PHP5-FPM backend from package with proxy_pass.

main nginx config:

user www-data;
worker_processes 2;

error_log  /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;

events {
  worker_connections 1024;
  use epoll;
}


http {
  server_names_hash_bucket_size 64;
  sendfile on;
  tcp_nopush  on;
  tcp_nodelay off;

  client_max_body_size 64M;

  include /etc/nginx/mime.types;

  default_type text/html;

  types_hash_max_size 8192;

  log_format main '$remote_addr - $remote_user [$time_local] '
                '"$request" $status $body_bytes_sent "$http_referer" '
                '"$http_user_agent" "$http_x_forwarded_for"' ;

  access_log /var/log/nginx/access.log main;

  ## Compression
  gzip on;
  gzip_min_length 1000;
  gzip_http_version 1.1;
  gzip_comp_level 1;
  gzip_proxied any;
  gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

  include /etc/nginx/sites-enabled/*;
}

I remove gzip_disable, I read bugs about it with Ubuntu.

nginx compile config:

apt-get source nginx

auto/options contains:

HTTP_GZIP=YES
HTTP_GZIP_STATIC=NO

Please someone say something what do I miss.

petermolnar
  • 1,029
  • 1
  • 12
  • 17
  • How have you confirmed that the output is not compressing properly? Can you provide request/response headers of a request that should be compressed but isn't? – Shane Madden Oct 26 '11 at 18:53

2 Answers2

0

I do not really understand, what happened, but somehow it came alive. I did not change anything, just rebooted the VPS. This is definately strange.

petermolnar
  • 1,029
  • 1
  • 12
  • 17
0

You need to reload or restart nginx.

If you didn't do this, then a restart of the OS would have achieved the same thing for you (though it was probably unnecessary).

Drew Khoury
  • 4,637
  • 8
  • 27
  • 28