Optimise loading of piwik javascript
[chef.git] / cookbooks / piwik / templates / default / apache.erb
1 # DO NOT EDIT - This file is being maintained by Chef
2
3 <VirtualHost *:443>
4         ServerName piwik.openstreetmap.org
5         ServerAlias piwik.osm.org
6         ServerAdmin webmaster@openstreetmap.org
7
8         SSLEngine on
9         SSLCertificateFile /etc/ssl/certs/piwik.openstreetmap.org.pem
10         SSLCertificateKeyFile /etc/ssl/private/piwik.openstreetmap.org.key
11
12         CustomLog /var/log/apache2/piwik.openstreetmap.org-access.log combined
13         ErrorLog /var/log/apache2/piwik.openstreetmap.org-error.log
14
15         Options -Indexes
16
17         DocumentRoot /srv/piwik.openstreetmap.org
18 </VirtualHost>
19
20 <VirtualHost *:80>
21         ServerName piwik.openstreetmap.org
22         ServerAlias piwik.osm.org
23         ServerAdmin webmaster@openstreetmap.org
24
25         CustomLog /var/log/apache2/piwik.openstreetmap.org-access.log combined
26         ErrorLog /var/log/apache2/piwik.openstreetmap.org-error.log
27
28         RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
29         RedirectPermanent / https://piwik.openstreetmap.org/
30 </VirtualHost>
31
32 <Directory /srv/piwik.openstreetmap.org>
33         Require all granted
34
35         ExpiresActive On
36         RewriteEngine on
37
38         RewriteCond "%{HTTP:Accept-encoding}" "gzip"
39         RewriteCond "%{REQUEST_FILENAME}\.gz" -s
40         RewriteRule "^(.*)\.js" "$1\.js\.gz" [QSA]
41
42         RewriteRule "\.js\.gz$"  "-" [T=text/javascript,E=no-gzip:1]
43
44         <FilesMatch "\.js\.gz$">
45                 Header append Content-Encoding gzip
46                 Header append Vary Accept-Encoding
47         </FilesMatch>
48
49         <FilesMatch "(\.js|\.js\.gz)$">
50                 ExpiresDefault "access plus 1 week"
51                 Header set Cache-Control "max-age=604800"
52         </FilesMatch>
53 </Directory>