title: Rails/NGinx - Cant get gzip compression of page working
body: <p>I got a Rails app (3.2.x) running on Ubuntu and using Passenger.</p>
  
  <p>I added the option</p>
  
  <pre><code>gzip on;
  </code></pre>
  
  <p>into the nginx.conf file but testing the page with </p>
  
  <pre><code>http://www.gidnetwork.com/tools/gzip-test.php
  </code></pre>
  
  <p>shows that compression is not used.</p>
  
  <p>My nginx.conf file looks as follows:</p>
  
  <pre><code>worker_processes  8;
  events {
      worker_connections  1024;
  }
  http {
      passenger_root /usr/local/rvm/gems/ruby-1.9.3-p392/gems/passenger-3.0.19;
      passenger_ruby /usr/local/rvm/wrappers/ruby-1.9.3-p392/ruby;
      include       mime.types;
      default_type  application/octet-stream;
      sendfile        on;
      keepalive_timeout  65;
      gzip  on;
      server {
        listen    80;
        server_name  xxx.com;
        root /var/www/xxx/public;  
        rewrite        ^ https://$server_name$request_uri? permanent;
        passenger_enabled on;
      }
      server {
        listen 443;
        server_name xxx.com;
        root /var/www/xxx/public;
        passenger_enabled on;
        ssl on;
        ssl_certificate     /etc/ssl/private/ssl_xxx_com_certificate.txt;
        ssl_certificate_key /etc/ssl/private/ssl_xxx_com_private_key.txt;
        ssl_client_certificate /etc/ssl/private/cabundle.txt;
        ssl_session_timeout  5m;
        ssl_protocols  SSLv2 SSLv3 TLSv1;
        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers   on;
      }
  }
  </code></pre>