]> git.openstreetmap.org Git - chef.git/blob - cookbooks/matomo/templates/default/apache.erb
Use ruby cookbook to install ruby for prometheus
[chef.git] / cookbooks / matomo / templates / default / apache.erb
1 # DO NOT EDIT - This file is being maintained by Chef
2
3 <VirtualHost *:443>
4         ServerName matomo.openstreetmap.org
5         ServerAdmin webmaster@openstreetmap.org
6
7         SSLEngine on
8         SSLCertificateFile /etc/ssl/certs/matomo.openstreetmap.org.pem
9         SSLCertificateKeyFile /etc/ssl/private/matomo.openstreetmap.org.key
10
11         CustomLog /var/log/apache2/matomo.openstreetmap.org-access.log combined_extended
12         ErrorLog /var/log/apache2/matomo.openstreetmap.org-error.log
13
14         Options -Indexes
15
16         DocumentRoot /srv/matomo.openstreetmap.org
17
18         Redirect 403 /core/
19         Redirect 403 /config/
20         Redirect 403 /lang/
21         Redirect 403 /tmp/
22 </VirtualHost>
23
24 <VirtualHost *:443>
25         ServerName matomo.osm.org
26         ServerAlias piwik.openstreetmap.org
27         ServerAlias piwik.osm.org
28         ServerAdmin webmaster@openstreetmap.org
29
30         SSLEngine on
31         SSLCertificateFile /etc/ssl/certs/matomo.openstreetmap.org.pem
32         SSLCertificateKeyFile /etc/ssl/private/matomo.openstreetmap.org.key
33
34         CustomLog /var/log/apache2/matomo.openstreetmap.org-access.log combined_extended
35         ErrorLog /var/log/apache2/matomo.openstreetmap.org-error.log
36
37         RedirectPermanent / https://matomo.openstreetmap.org/
38 </VirtualHost>
39
40 <VirtualHost *:80>
41         ServerName matomo.openstreetmap.org
42         ServerAlias matomo.osm.org
43         ServerAlias piwik.openstreetmap.org
44         ServerAlias piwik.osm.org
45         ServerAdmin webmaster@openstreetmap.org
46
47         CustomLog /var/log/apache2/matomo.openstreetmap.org-access.log combined_extended
48         ErrorLog /var/log/apache2/matomo.openstreetmap.org-error.log
49
50         RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
51         RedirectPermanent / https://matomo.openstreetmap.org/
52 </VirtualHost>
53
54 <Directory /srv/matomo.openstreetmap.org>
55         Require all granted
56
57         ExpiresActive On
58         RewriteEngine on
59
60         RewriteCond "%{HTTP:Accept-Encoding}" "br"
61         RewriteCond "%{REQUEST_FILENAME}\.br" -s
62         RewriteRule "^(.*)\.js" "$1\.js\.br" [QSA]
63
64         RewriteCond "%{HTTP:Accept-Encoding}" "gzip"
65         RewriteCond "%{REQUEST_FILENAME}\.gz" -s
66         RewriteRule "^(.*)\.js" "$1\.js\.gz" [QSA]
67
68         RewriteRule "\.js\.(br|gz)$"  "-" [T=text/javascript,E=no-gzip:1,E=no-brotli:1]
69
70         <FilesMatch "\.js\.br$">
71                 Header append Content-Encoding br
72                 Header append Vary Accept-Encoding
73         </FilesMatch>
74
75         <FilesMatch "\.js\.gz$">
76                 Header append Content-Encoding gzip
77                 Header append Vary Accept-Encoding
78         </FilesMatch>
79
80         <FilesMatch "(\.js|\.js\.gz|\.js\.br)$">
81                 ExpiresDefault "access plus 1 week"
82                 Header set Cache-Control "max-age=604800"
83         </FilesMatch>
84
85         <FilesMatch ".+\.ph(ar|p|tml)$">
86                 SetHandler "proxy:unix:/run/php/php-matomo.openstreetmap.org-fpm.sock|fcgi://127.0.0.1"
87         </FilesMatch>
88 </Directory>