Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
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 Answers 2

up vote 0 down vote accepted

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.

share|improve this answer
    
This probably caused a restart of nginx so it was finally looking at the updated config. –  Drew Khoury Apr 6 '13 at 5:22

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).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.