When we install all packages from Nginx and Apache, there is a double configuration for Gzip.
In nginx.conf, I see:
# Compression
gzip on;
gzip_vary on;
gzip_static on;
gzip_comp_level 6;
gzip_min_length 1024;
gzip_buffers 128 4k;
gzip_http_version 1.1;
gzip_types text/css text/javascript text/js text/plain text/richtext text/shtml text/x-component text/x-java-source text/x-markdown text/x-script text/xml image/bmp image/svg+xml image/vnd.microsoft.icon image/x-icon font/otf font/ttf font/x-woff multipart/bag multipart/mixed application/eot application/font application/font-sfnt application/font-woff application/javascript application/javascript-binast application/json application/ld+json application/manifest+json application/opentype application/otf application/rss+xml application/ttf application/truetype application/vnd.api+json application/vnd.ms-fontobject application/wasm application/xhtml+xml application/xml application/xml+rss application/x-httpd-cgi application/x-javascript application/x-opentype application/x-otf application/x-perl application/x-protobuf application/x-ttf;
gzip_proxied any;
In /etc/apache2/mods-enabled/deflate.conf, I see
root@ploum:/etc/apache2/mods-enabled# cat deflate.conf
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/wasm
AddOutputFilterByType DEFLATE application/xml
</IfModule>
By default Gzip in Nginx compresses mime type text/html so that you don’t need to change /etc/nginx/nginx.conf
I guess it is better to let Nginx handle all GZIP compression for All mime types (file types).
So, I did “sudo a2dismod deflate” to disable GZIP module on Apache 2.4
Without doing anything Nginx automatically handles the Gzip compression.
My dynamic content is now Gzipped by Nginx. The idea is to let Apache focus on retrieving dynamic content and Nginx focus on Gzip compression.
What do you think?
Do you see any reasons why Gzip should be activated in Apache?