1 # DO NOT EDIT - This file is being maintained by Chef
4 ServerName <%= @name %>
5 <% @aliases.each do |alias_name| -%>
6 ServerAlias <%= alias_name %>
9 ServerAdmin webmaster@openstreetmap.org
11 LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\" %Dus" combined_with_time
12 CustomLog /var/log/apache2/<%= @name %>-access.log combined_with_time
13 ErrorLog /var/log/apache2/<%= @name %>-error.log
15 RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
16 RedirectPermanent / https://<%= @name %>/
20 ServerName <%= @name %>
21 <% @aliases.each do |alias_name| -%>
22 ServerAlias <%= alias_name %>
25 ServerAdmin webmaster@openstreetmap.org
28 SSLCertificateFile /etc/ssl/certs/<%= @name %>.pem
29 SSLCertificateKeyFile /etc/ssl/private/<%= @name %>.key
31 LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\" %Dus" combined_with_time
32 CustomLog /var/log/apache2/<%= @name %>-secure-access.log combined_with_time
33 ErrorLog /var/log/apache2/<%= @name %>-secure-error.log
35 DocumentRoot <%= @directory %>
37 AllowEncodedSlashes NoDecode
41 RewriteCond %{SERVER_NAME} !=<%= @name %>
42 RewriteRule ^/(.*)$ https://<%= @name %>/$1 [R=permanent]
44 # Historical Compatibility Links
45 RedirectMatch 301 ^/index\.php$ /w/index.php
46 RedirectMatch 301 ^/index\.php/(.*)$ /wiki/$1
47 RedirectMatch 301 ^/skins/(.*)$ /w/skins/$1
48 RedirectMatch 301 ^/images/(.*)$ /w/images/$1
49 RedirectMatch 301 ^/api\.php$ /w/api.php
50 RedirectMatch 301 ^/opensearch_desc\.php$ /w/opensearch_desc.php
52 # Support Wikidata redirects based on Wikimedia's redirects:
53 # https://github.com/wikimedia/puppet/blob/production/modules/mediawiki/files/apache/sites/wikidata-uris.incl
54 RedirectMatch 301 ^/entity/statement/([QqPp]\d+).*$ /wiki/Special:EntityData/$1
55 RedirectMatch 301 ^/value/(.*)$ /wiki/Special:ListDatatypes
56 RedirectMatch 301 ^/reference/(.*)$ https://wikidata.org/wiki/Help:Sources
57 RedirectMatch 301 ^/prop/direct/(.*)$ /wiki/Property:$1
58 RedirectMatch 301 ^/prop/direct-normalized/(.*)$ /wiki/Property:$1
59 RedirectMatch 301 ^/prop/novalue/(.*)$ /wiki/Property:$1
60 RedirectMatch 301 ^/prop/statement/value/(.*)$ /wiki/Property:$1
61 RedirectMatch 301 ^/prop/statement/value-normalized/(.*)$ /wiki/Property:$1
62 RedirectMatch 301 ^/prop/qualifier/value/(.*)$ /wiki/Property:$1
63 RedirectMatch 301 ^/prop/qualifier/value-normalized/(.*)$ /wiki/Property:$1
64 RedirectMatch 301 ^/prop/reference/value/(.*)$ /wiki/Property:$1
65 RedirectMatch 301 ^/prop/reference/value-normalized/(.*)$ /wiki/Property:$1
66 RedirectMatch 301 ^/prop/statement/(.*)$ /wiki/Property:$1
67 RedirectMatch 301 ^/prop/qualifier/(.*)$ /wiki/Property:$1
68 RedirectMatch 301 ^/prop/reference/(.*)$ /wiki/Property:$1
69 RedirectMatch 301 ^/prop/(.*)$ /wiki/Property:$1
70 RedirectMatch 301 ^/entity/(.*)$ /wiki/Special:EntityData/$1
72 Alias /wiki <%= @directory %>/w/index.php
74 # Support /pagename -> /wiki/pagename
76 RewriteRule ^/$ /w/index.php?title=Main_Page [L,QSA]
77 RewriteCond %{REQUEST_URI} !^/w/
78 RewriteCond %{REQUEST_URI} !^/wiki/
79 RewriteCond %{REQUEST_URI} !^/index\.php
80 RewriteCond %{REQUEST_URI} !^/skins/
81 RewriteCond %{REQUEST_URI} !^/images/
82 RewriteCond %{REQUEST_URI} !^/api\.php$
83 RewriteCond %{REQUEST_URI} !^/opensearch_desc\.php$
84 RewriteCond %{REQUEST_URI} !^/entity/
85 RewriteCond %{REQUEST_URI} !^/value/
86 RewriteCond %{REQUEST_URI} !^/reference/
87 RewriteCond %{REQUEST_URI} !^/prop/
88 RewriteCond %{REQUEST_URI} !^/dump/
89 RewriteCond %{REQUEST_URI} !^/server-status
90 RewriteCond %{REQUEST_URI} !^/.well-known/
91 RewriteCond %{LA-U:REQUEST_FILENAME} !-f
92 RewriteCond %{LA-U:REQUEST_FILENAME} !-d
93 RewriteRule ^/(.*) /wiki/$1 [R,L]
95 <Directory <%= @directory %>>
99 <FilesMatch ".+\.ph(ar|p|tml)$">
100 SetHandler "proxy:unix:/run/php/php-<%= @name %>-fpm.sock|fcgi://127.0.0.1"
104 <Directory <%= @directory %>/w/images/>
105 Options -ExecCGI -Includes -Indexes
107 AddType text/plain .html .htm .shtml
108 <% if @private_site -%>
111 <FilesMatch ".+\.ph(ar|p|tml)$">
116 <Directory <%= @directory %>/w/images/thumb/>
119 RewriteCond %{REQUEST_FILENAME} !-f
120 RewriteCond %{REQUEST_FILENAME} !-d
121 RewriteRule ^[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/page([0-9]+)-([0-9]+)px-.*$ /w/thumb.php?f=$1&page=$2&width=$3 [L,QSA,B]
123 RewriteCond %{REQUEST_FILENAME} !-f
124 RewriteCond %{REQUEST_FILENAME} !-d
125 RewriteRule ^archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/page([0-9]+)-([0-9]+)px-.*$ /w/thumb.php?f=$1&page=$2&width=$3&archived=1 [L,QSA,B]
127 RewriteCond %{REQUEST_FILENAME} !-f
128 RewriteCond %{REQUEST_FILENAME} !-d
129 RewriteRule ^[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /w/thumb.php?f=$1&width=$2 [L,QSA,B]
131 RewriteCond %{REQUEST_FILENAME} !-f
132 RewriteCond %{REQUEST_FILENAME} !-d
133 RewriteRule ^archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /w/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]
136 <Directory <%= @directory %>/w/maintenance/>
140 <Files <%= @directory %>/w/LocalSettings.php>
144 <Directory <%= @directory %>/w/cache/>
145 Options -ExecCGI -Includes -Indexes
147 AddType text/plain .html .htm .shtml
148 <FilesMatch ".+\.ph(ar|p|tml)$">
153 <Directory <%= @directory %>/dump/>
154 Options Indexes FollowSymLinks MultiViews
156 IndexIgnore .ht* . robots.txt HEADER.html HEADER.cgi logo.png style.css
157 IndexOptions FancyIndexing FoldersFirst NameWidth=* TrackModified
158 IndexOrderDefault Descending Date
161 <Directory ~ "\.svn">
165 <Directory ~ "\.git">