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.

My current setup is as following: Apache -> Nginx -> Varnish running on Ubuntu

apache2.conf: h**p://pastebin.com/A3wehAbe

.htaccess: h**p://pastebin.com/Yre4hdSy (edited to allow deflate)

nginx.conf: h**p://pastebin.com/6X59CTAr (gzip enabled)

varnish: default settings

My problem is, it seems that GZIP only works with html content, not css or js.

I tested GZIP with this tool at: http://www.gidnetwork.com/tools/gzip-test.php

  1. h**p://rentsites.com.au result: compressed yes

    status HTTP/1.1 200 OK server nginx/0.7.65 content-type text/html; charset=UTF-8 x-powered-by PHP/5.3.2-1ubuntu4.22 x-pingback h**p://rentsites.com.au/xmlrpc.php vary Accept-Encoding content-encoding gzip content-length 2281 accept-ranges bytes date Mon, 13 Jan 201400:50:26 GMT x-varnish 785049695 785049694 age 13 via 1.1 varnish connection close

  2. h**p://rentsites.com.au/wp-includes/js/jquery/jquery.js result: compressed NO

    status HTTP/1.1 200 OK server nginx/0.7.65 content-type application/x-javascript last-modified Wed, 21 Aug 2013 15:41:10 GMT expires Mon, 12 Jan 2015 23:17:22 GMT cache-control max-age=31536000, public pragma public content-length 93085 accept-ranges bytes date Mon, 13 Jan 2014 00:27:30 GMT x-varnish 785049693 785049631 age 4208 via 1.1 varnish connection close

  3. h**p://rentsites.com.au/wp-content/themes/twentyfourteen/genericons/genericons.css result: compressed NO

    status HTTP/1.1 200 OK server nginx/0.7.65 content-type text/css last-modified Tue, 12 Nov 2013 18:38:10 GMT expires Mon, 12 Jan 2015 23:16:50 GMT cache-control max-age=31536000, public pragma public content-length 22680 accept-ranges bytes date Mon, 13 Jan 2014 00:52:38 GMT x-varnish 785049696 785049621 age 5748 via 1.1 varnish connection close

Please help. Thanks for reading.

share|improve this question
    
Hmmm, your structure: Apache -> Nginx -> Varnish looks a little confusing for me. However only Nginx and Apache are able to gzip/deflate content. Varnish is able to cache it but doesn't know about it's content. For Varnish a gzipped element and an un-gzipped element are different objects. To find the responsible application try to use your test tool against each single application (e.g. Apache is listening on port 8000, Nginx is listening on port 8080 and Varnish is listening on port 80). –  Jens Bradler Jan 14 at 6:59

1 Answer 1

Turns out we need to add this to .htaccess:

AddType text/css .css
AddType text/javascript .js
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.