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 CustomLog /var/log/apache2/<%= @name %>-access.log combined
12 ErrorLog /var/log/apache2/<%= @name %>-error.log
14 RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
15 RedirectPermanent / https://<%= @name %>/
19 ServerName <%= @name %>
20 <% @aliases.each do |alias_name| -%>
21 ServerAlias <%= alias_name %>
24 ServerAdmin webmaster@openstreetmap.org
27 SSLCertificateFile /etc/ssl/certs/<%= @name %>.pem
28 SSLCertificateKeyFile /etc/ssl/private/<%= @name %>.key
30 CustomLog /var/log/apache2/<%= @name %>-secure-access.log combined
31 ErrorLog /var/log/apache2/<%= @name %>-secure-error.log
33 DocumentRoot <%= @directory %>
35 RewriteCond %{SERVER_NAME} !=<%= @name %>
36 RewriteRule ^/(.*)$ https://<%= @name %>/$1 [R=permanent]
38 RedirectMatch 301 ^/$ /wiki/Main_Page
40 #Historical Compatibility Links
41 RedirectMatch 301 ^/index\.php$ /w/index.php
42 RedirectMatch 301 ^/index\.php/(.*)$ /wiki/$1
43 RedirectMatch 301 ^/skins/(.*)$ /w/skins/$1
44 RedirectMatch 301 ^/images/(.*)$ /w/images/$1
45 RedirectMatch 301 ^/api\.php$ /w/api.php
46 RedirectMatch 301 ^/opensearch_desc\.php$ /w/opensearch_desc.php
48 #Support Wikidata redirects based on Wikimedia's redirects:
49 # https://github.com/wikimedia/puppet/blob/production/modules/mediawiki/files/apache/sites/wikidata-uris.incl
50 RedirectMatch 301 ^/entity/statement/([QqPp]\d+).*$ /wiki/Special:EntityData/$1
51 RedirectMatch 301 ^/value/(.*)$ /wiki/Special:ListDatatypes
52 RedirectMatch 301 ^/reference/(.*)$ https://wikidata.org/wiki/Help:Sources
53 RedirectMatch 301 ^/prop/direct/(.*)$ /wiki/Property:$1
54 RedirectMatch 301 ^/prop/direct-normalized/(.*)$ /wiki/Property:$1
55 RedirectMatch 301 ^/prop/novalue/(.*)$ /wiki/Property:$1
56 RedirectMatch 301 ^/prop/statement/value/(.*)$ /wiki/Property:$1
57 RedirectMatch 301 ^/prop/statement/value-normalized/(.*)$ /wiki/Property:$1
58 RedirectMatch 301 ^/prop/qualifier/value/(.*)$ /wiki/Property:$1
59 RedirectMatch 301 ^/prop/qualifier/value-normalized/(.*)$ /wiki/Property:$1
60 RedirectMatch 301 ^/prop/reference/value/(.*)$ /wiki/Property:$1
61 RedirectMatch 301 ^/prop/reference/value-normalized/(.*)$ /wiki/Property:$1
62 RedirectMatch 301 ^/prop/statement/(.*)$ /wiki/Property:$1
63 RedirectMatch 301 ^/prop/qualifier/(.*)$ /wiki/Property:$1
64 RedirectMatch 301 ^/prop/reference/(.*)$ /wiki/Property:$1
65 RedirectMatch 301 ^/prop/(.*)$ /wiki/Property:$1
66 RedirectMatch 301 ^/entity/(.*)$ /wiki/Special:EntityData/$1
68 Alias /wiki <%= @directory %>/w/index.php
70 #Support /pagename -> /wiki/pagename
72 RewriteCond %{REQUEST_URI} !^/w/
73 RewriteCond %{REQUEST_URI} !^/wiki/
74 RewriteCond %{REQUEST_URI} !^/index\.php
75 RewriteCond %{REQUEST_URI} !^/skins/
76 RewriteCond %{REQUEST_URI} !^/images/
77 RewriteCond %{REQUEST_URI} !^/api\.php$
78 RewriteCond %{REQUEST_URI} !^/opensearch_desc\.php$
79 RewriteCond %{REQUEST_URI} !^/entity/
80 RewriteCond %{REQUEST_URI} !^/value/
81 RewriteCond %{REQUEST_URI} !^/reference/
82 RewriteCond %{REQUEST_URI} !^/prop/
83 RewriteCond %{REQUEST_URI} !^/dump/
84 RewriteCond %{REQUEST_URI} !^/server-status
85 RewriteCond %{REQUEST_URI} !^/.well-known/
86 RewriteCond %{LA-U:REQUEST_FILENAME} !-f
87 RewriteCond %{LA-U:REQUEST_FILENAME} !-d
88 RewriteRule ^/(.*) /wiki/$1 [R,L]
90 <Directory <%= @directory %>>
94 <FilesMatch ".+\.ph(ar|p|tml)$">
95 SetHandler "proxy:unix:/run/php/<%= @name %>.sock|fcgi://127.0.0.1"
99 <Directory <%= @directory %>/w/images/>
100 Options -ExecCGI -Includes -Indexes
102 AddType text/plain .html .htm .shtml
103 <% if @private_site -%>
106 <FilesMatch ".+\.ph(ar|p|tml)$">
111 <Directory <%= @directory %>/w/images/thumb/>
114 RewriteCond %{REQUEST_FILENAME} !-f
115 RewriteCond %{REQUEST_FILENAME} !-d
116 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]
118 RewriteCond %{REQUEST_FILENAME} !-f
119 RewriteCond %{REQUEST_FILENAME} !-d
120 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]
122 RewriteCond %{REQUEST_FILENAME} !-f
123 RewriteCond %{REQUEST_FILENAME} !-d
124 RewriteRule ^[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /w/thumb.php?f=$1&width=$2 [L,QSA,B]
126 RewriteCond %{REQUEST_FILENAME} !-f
127 RewriteCond %{REQUEST_FILENAME} !-d
128 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]
131 <Directory <%= @directory %>/w/maintenance/>
135 <Files <%= @directory %>/w/LocalSettings.php>
139 <Directory <%= @directory %>/w/cache/>
140 Options -ExecCGI -Includes -Indexes
142 AddType text/plain .html .htm .shtml
143 <FilesMatch ".+\.ph(ar|p|tml)$">
148 <Directory <%= @directory %>/dump/>
149 Options Indexes FollowSymLinks MultiViews
151 IndexIgnore .ht* . robots.txt HEADER.html HEADER.cgi logo.png style.css
152 IndexOptions FancyIndexing FoldersFirst NameWidth=* TrackModified
153 IndexOrderDefault Descending Date
156 <Directory ~ "\.svn">
160 <Directory ~ "\.git">