package "geoipupdate"
+apache_module "expires"
apache_module "php7.2"
+apache_module "rewrite"
version = node[:piwik][:version]
not_if { File.exist?("/opt/piwik-#{version}/piwik") }
end
+execute "/opt/piwik-#{version}/piwik/piwik.js" do
+ command "gzip -k -9 /opt/piwik-#{version}/piwik/piwik.js"
+ cwd "/opt/piwik-#{version}"
+ user "root"
+ group "root"
+ not_if { File.exist?("/opt/piwik-#{version}/piwik/piwik.js.gz") }
+end
+
directory "/opt/piwik-#{version}/piwik/config" do
owner "www-data"
group "www-data"
<Directory /srv/piwik.openstreetmap.org>
Require all granted
+
+ ExpiresActive On
+ RewriteEngine on
+
+ RewriteCond "%{HTTP:Accept-encoding}" "gzip"
+ RewriteCond "%{REQUEST_FILENAME}\.gz" -s
+ RewriteRule "^(.*)\.js" "$1\.js\.gz" [QSA]
+
+ RewriteRule "\.js\.gz$" "-" [T=text/javascript,E=no-gzip:1]
+
+ <FilesMatch "\.js\.gz$">
+ Header append Content-Encoding gzip
+ Header append Vary Accept-Encoding
+ </FilesMatch>
+
+ <FilesMatch "(\.js|\.js\.gz)$">
+ ExpiresDefault "access plus 1 week"
+ Header set Cache-Control "max-age=604800"
+ </FilesMatch>
</Directory>