0

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.

Quintin Par
  • 4,373
  • 11
  • 49
  • 72

1 Answers1

2

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)

the-wabbit
  • 40,737
  • 13
  • 111
  • 174
  • Nginx has `gzip_comp_level` to configure compression level as well. – Alexander Azarov Jun 04 '11 at 07:58
  • My Q is on Nginx vs Apache. – Quintin Par Jun 04 '11 at 08: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 04 '11 at 10:23
  • 1
    Nginx seems to be a choice to make not based on compression, but for it's specific performance and features in certain circumstances. See http://www.linuxjournal.com/magazine/nginx-high-performance-web-server-and-reverse-proxy – Bart Silverstrim Jun 04 '11 at 10:26