diff options
author | Dan Fandrich <danf@mageia.org> | 2024-10-15 13:35:47 -0700 |
---|---|---|
committer | Dan Fandrich <danf@mageia.org> | 2024-10-15 13:59:57 -0700 |
commit | a8116343fd31737660b56357f4179f7cf2584255 (patch) | |
tree | 61036ddc24b47c4dfe0ddbfa70dd5720a3d30735 /modules | |
parent | 7e76bca173b5989cf938a9767b677aabec048608 (diff) | |
download | puppet-a8116343fd31737660b56357f4179f7cf2584255.tar puppet-a8116343fd31737660b56357f4179f7cf2584255.tar.gz puppet-a8116343fd31737660b56357f4179f7cf2584255.tar.bz2 puppet-a8116343fd31737660b56357f4179f7cf2584255.tar.xz puppet-a8116343fd31737660b56357f4179f7cf2584255.zip |
Enable transparent compression on Apache (mga#6969)
This will increase CPU usage somewhat, but the reduction in required
bandwidth ought to make it a win for users. The compression level is set
to the lowest setting to keep CPU usage down.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/apache/manifests/base.pp | 2 | ||||
-rw-r--r-- | modules/apache/templates/50_mod_deflate.conf | 36 |
2 files changed, 38 insertions, 0 deletions
diff --git a/modules/apache/manifests/base.pp b/modules/apache/manifests/base.pp index b24b740e..9190867a 100644 --- a/modules/apache/manifests/base.pp +++ b/modules/apache/manifests/base.pp @@ -40,6 +40,8 @@ class apache::base { '/etc/httpd/conf/vhosts.d/00_default_vhosts.conf': content => template('apache/00_default_vhosts.conf'), require => Package[$apache::var::pkg_conf]; + '/etc/httpd/conf/modules.d/50_mod_deflate.conf': + content => template('apache/50_mod_deflate.conf'); } file { '/etc/logrotate.d/httpd': diff --git a/modules/apache/templates/50_mod_deflate.conf b/modules/apache/templates/50_mod_deflate.conf new file mode 100644 index 00000000..09edf006 --- /dev/null +++ b/modules/apache/templates/50_mod_deflate.conf @@ -0,0 +1,36 @@ +<IfModule mod_deflate.c> + # Compress HTML, CSS, JavaScript, Text, XML and fonts + AddOutputFilterByType DEFLATE application/javascript + AddOutputFilterByType DEFLATE application/json + AddOutputFilterByType DEFLATE application/rss+xml + AddOutputFilterByType DEFLATE application/vnd.ms-fontobject + AddOutputFilterByType DEFLATE application/x-font + AddOutputFilterByType DEFLATE application/x-font-opentype + AddOutputFilterByType DEFLATE application/x-font-otf + AddOutputFilterByType DEFLATE application/x-font-truetype + AddOutputFilterByType DEFLATE application/x-font-ttf + AddOutputFilterByType DEFLATE application/x-javascript + AddOutputFilterByType DEFLATE application/xhtml+xml + AddOutputFilterByType DEFLATE application/xml + AddOutputFilterByType DEFLATE font/opentype + AddOutputFilterByType DEFLATE font/otf + AddOutputFilterByType DEFLATE font/ttf + AddOutputFilterByType DEFLATE image/svg+xml + AddOutputFilterByType DEFLATE image/x-icon + AddOutputFilterByType DEFLATE text/css + AddOutputFilterByType DEFLATE text/html + AddOutputFilterByType DEFLATE text/javascript + AddOutputFilterByType DEFLATE text/plain + AddOutputFilterByType DEFLATE text/xml + + # Level of compression (9=highest compression level) + DeflateCompressionLevel 1 + + # Do not compress certain file types + SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|heif|heic|webp|mp4|mov|mpg|webm|avi)$ no-gzip dont-vary + SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|xz|zst|lzo|lzma|sit|rar|cab|rpm)$ no-gzip dont-vary + SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary + + # Make sure proxies don't deliver the wrong content + Header append Vary User-Agent env=!dont-vary +</IfModule> |