Forum archive
apache2 mod_deflate don't compress
Hi,
I use the turnkey lamp and have problems to enable compression by mode_deflate on a apache2 server. I don't have any idea why it is not working:
Modules are enabled:
# apache2ctl -M Loaded Modules: ... deflate_module (shared) expires_module (shared) filter_module (shared) mime_module (shared) ...
000-default.conf:
...
<Directory /var/www/>
Options -Indexes +FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
....htaccess
# Deflate Compression by MimeType
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-font-woff
</IfModule>
# Deflate Compression by FileType
<IfModule mod_deflate.c>
<FilesMatch "\.(js|jpg|jpeg|gif|png|svg|css|eot|ttf|woff)$">
ExpiresActive on
ExpiresDefault "access plus 1 month"
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
# turns cache on for 1 month
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 month"
</IfModule>
<IfModule mod_headers.c>
<filesmatch "\\.(ico|jpe?g|png|gif|svg|swf|eot|ttf|woff)$">
Header set Cache-Control "max-age=2592000, public"
</filesmatch>
<filesmatch "\\.(css)$">
Header set Cache-Control "max-age=604800, public"
</filesmatch>
<filesmatch "\\.(js)$">
Header set Cache-Control "max-age=604800, public"
</filesmatch>
</IfModule>
PageSpeed Insights says: compression not active for svg-, css-, js- and html-files? Can someone help? Thanks!
IIRC compression over SSL is a security concern (I forget the name, BREACH vulnerability perhaps?) so we disabled it by default. If you're using SSL, then perhaps that's it?
Otherwise, TBH, I'm not sure.
Perhaps you could just have a grep through the Apache conf files and see if anything comes up? E.g.:
'-i' is case-insensitive, '-r' is recursive.