]> git.openstreetmap.org Git - chef.git/blob - cookbooks/piwik/templates/default/apache.erb
Block access to some piwik internals
[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
19         Redirect 403 /core/
20         Redirect 403 /config/
21         Redirect 403 /lang/
22         Redirect 403 /tmp/
23 </VirtualHost>
24
25 <VirtualHost *:80>
26         ServerName piwik.openstreetmap.org
27         ServerAlias piwik.osm.org
28         ServerAdmin webmaster@openstreetmap.org
29
30         CustomLog /var/log/apache2/piwik.openstreetmap.org-access.log combined
31         ErrorLog /var/log/apache2/piwik.openstreetmap.org-error.log
32
33         RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
34         RedirectPermanent / https://piwik.openstreetmap.org/
35 </VirtualHost>
36
37 <Directory /srv/piwik.openstreetmap.org>
38         Require all granted
39
40         ExpiresActive On
41         RewriteEngine on
42
43         RewriteCond "%{HTTP:Accept-encoding}" "gzip"
44         RewriteCond "%{REQUEST_FILENAME}\.gz" -s
45         RewriteRule "^(.*)\.js" "$1\.js\.gz" [QSA]
46
47         RewriteRule "\.js\.gz$"  "-" [T=text/javascript,E=no-gzip:1]
48
49         <FilesMatch "\.js\.gz$">
50                 Header append Content-Encoding gzip
51                 Header append Vary Accept-Encoding
52         </FilesMatch>
53
54         <FilesMatch "(\.js|\.js\.gz)$">
55                 ExpiresDefault "access plus 1 week"
56                 Header set Cache-Control "max-age=604800"
57         </FilesMatch>
58
59         <FilesMatch ".+\.ph(ar|p|tml)$">
60                 SetHandler "proxy:unix:/run/php/piwik.openstreetmap.org.sock|fcgi://127.0.0.1"
61         </FilesMatch>
62 </Directory>