Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an nginx reverse proxy in front of my apache server.

How should I configure compression (gzip or deflate) to serve my website? Should it be from nginx or from mod_deflate from apache? My primary concern is performance and memory usage.

share|improve this question… – Quintin Par Jun 4 '11 at 12:34
up vote 2 down vote accepted

Both represent the same compression algorithm with a different format (gzip adds checksums). There is a similar question with a couple of good answers here.

There is a web service testing compressed sites and showing the compression ratio if you are interested in this kind of data. Although the data is not going to be comparable among different pages - the compression ratio depends on the properties of input data.

Edit: additionally, the compression level is configurable - Apache has the DeflateCompressionLevel directive for configuring this.

Edit #2: Nginx has the gzip_comp_level directive for the same purpose (thanks Alaz)

And just in case it was not clear enough yet: given the same input data and the same compression level setting, you will see virtually the same compression ratio with both implementations (give or take a few bytes for the gzip checksums)

share|improve this answer
Nginx has gzip_comp_level to configure compression level as well. – Alexander Azarov Jun 4 '11 at 7:58
My Q is on Nginx vs Apache. – Quintin Par Jun 4 '11 at 8:38
...he said they're both based on the same algorithm, just formatted differently. He pointed you to different comparison questions and sites as well for reference. I think his answer is basically telling you that nginx and apache are both doing the same thing underneath when it comes to compression, so it doesn't matter much; it depends on the compressibility of the content you're serving. If they had different compression engines it might be different. – Bart Silverstrim Jun 4 '11 at 10:23
Nginx seems to be a choice to make not based on compression, but for it's specific performance and features in certain circumstances. See… – Bart Silverstrim Jun 4 '11 at 10:26

Your Answer


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.