]> git.openstreetmap.org Git - chef.git/blob - cookbooks/mediawiki/templates/default/apache.erb
Revert "Move readonly load to katla"
[chef.git] / cookbooks / mediawiki / templates / default / apache.erb
1 # DO NOT EDIT - This file is being maintained by Chef
2
3 <VirtualHost *:80>
4   ServerName <%= @name %>
5 <% @aliases.each do |alias_name| -%>
6   ServerAlias <%= alias_name %>
7 <% end -%>
8
9   ServerAdmin webmaster@openstreetmap.org
10
11   CustomLog /var/log/apache2/<%= @name %>-access.log combined
12   ErrorLog /var/log/apache2/<%= @name %>-error.log
13
14   DocumentRoot <%= @directory %>
15
16   php_admin_value open_basedir <%= @directory %>/:/usr/share/php/:/tmp/
17   #php_admin_value disable_functions "exec,shell_exec,system,passthru,popen,proc_open"
18   php_value memory_limit 128M
19   php_value max_execution_time 240
20   php_value upload_max_filesize 70M
21   php_value post_max_size 100M
22
23   RedirectMatch 301 ^/$                           /wiki/Main_Page
24
25   #Historical Compatibility Links
26   RedirectMatch 301 ^/index\.php$                 /w/index.php
27   RedirectMatch 301 ^/index\.php/(.*)$            /wiki/$1
28   RedirectMatch 301 ^/skins/(.*)$                 /w/skins/$1
29   RedirectMatch 301 ^/images/(.*)$                /w/images/$1
30   RedirectMatch 301 ^/api\.php$                   /w/api.php
31   RedirectMatch 301 ^/opensearch_desc\.php$       /w/opensearch_desc.php
32
33   Alias /wiki <%= @mediawiki[:directory] %>/index.php
34
35   #Support /pagename -> /wiki/pagename
36   RewriteEngine on
37   RewriteCond %{REQUEST_URI} !^/w/
38   RewriteCond %{REQUEST_URI} !^/wiki/
39   RewriteCond %{REQUEST_URI} !^/index\.php
40   RewriteCond %{REQUEST_URI} !^/skins/
41   RewriteCond %{REQUEST_URI} !^/images/
42   RewriteCond %{REQUEST_URI} !^/api\.php$
43   RewriteCond %{REQUEST_URI} !^/opensearch_desc\.php$
44   RewriteCond %{REQUEST_URI} !^/server-status
45   RewriteCond %{LA-U:REQUEST_FILENAME} !-f
46   RewriteCond %{LA-U:REQUEST_FILENAME} !-d
47   RewriteRule ^/(.*) /wiki/$1 [R,L]
48
49   <Directory <%= @directory %>>
50     Options -Indexes
51 <% if node[:lsb][:release].to_f >= 14.04 -%>
52     Require all granted
53 <% end -%>
54   </Directory>
55
56   <Directory <%= @mediawiki[:directory] %>/images/>
57     # No php execution in the upload area
58     php_admin_flag engine off
59     Options -ExecCGI -Includes -Indexes
60     AllowOverride None
61     AddType text/plain .html .htm .shtml
62 <% if @mediawiki[:private] -%>
63 <% if node[:lsb][:release].to_f >= 14.04 -%>
64     Require all denied
65 <% else -%>
66     Order allow,deny
67     Deny from all
68 <% end -%>
69 <% end -%>
70   </Directory>
71
72   <Directory <%= @mediawiki[:directory] %>/images/thumb/>
73     RewriteEngine on
74
75     RewriteCond %{REQUEST_FILENAME} !-f
76     RewriteCond %{REQUEST_FILENAME} !-d
77     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]
78
79     RewriteCond %{REQUEST_FILENAME} !-f
80     RewriteCond %{REQUEST_FILENAME} !-d
81     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]
82
83     RewriteCond %{REQUEST_FILENAME} !-f
84     RewriteCond %{REQUEST_FILENAME} !-d
85     RewriteRule ^[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /w/thumb.php?f=$1&width=$2 [L,QSA,B]
86
87     RewriteCond %{REQUEST_FILENAME} !-f
88     RewriteCond %{REQUEST_FILENAME} !-d
89     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]
90   </Directory>
91
92   <Directory <%= @mediawiki[:directory] %>/maintenance/>
93 <% if node[:lsb][:release].to_f >= 14.04 -%>
94     Require all denied
95 <% else -%>
96     Order allow,deny
97     Deny from all
98 <% end -%>
99   </Directory>
100
101   <Files <%= @mediawiki[:directory] %>/LocalSettings.php>
102 <% if node[:lsb][:release].to_f >= 14.04 -%>
103     Require all denied
104 <% else -%>
105     Order allow,deny
106     Deny from all
107 <% end -%>
108   </Files>
109
110   <Directory <%= @mediawiki[:directory] %>/cache/>
111     Options -ExecCGI -Includes -Indexes
112     AllowOverride None
113     AddType text/plain .html .htm .shtml
114     php_admin_flag engine off
115   </Directory>
116
117   <Directory ~ "\.svn">
118 <% if node[:lsb][:release].to_f >= 14.04 -%>
119     Require all denied
120 <% else -%>
121     Order allow,deny
122     Deny from all
123 <% end -%>
124   </Directory>
125
126   <Directory ~ "\.git">
127 <% if node[:lsb][:release].to_f >= 14.04 -%>
128     Require all denied
129 <% else -%>
130     Order allow,deny
131     Deny from all
132 <% end -%>
133   </Directory>
134
135   <Files ~ "~$">
136 <% if node[:lsb][:release].to_f >= 14.04 -%>
137     Require all denied
138 <% else -%>
139     Order allow,deny
140     Deny from all
141 <% end -%>
142   </Files>
143 </VirtualHost>
144 <% if @mediawiki[:enable_ssl] -%>
145 <VirtualHost *:443>
146   ServerName <%= @name %>
147 <% @aliases.each do |alias_name| -%>
148   ServerAlias <%= alias_name %>
149 <% end -%>
150
151   ServerAdmin webmaster@openstreetmap.org
152
153   SSLEngine on
154
155   CustomLog /var/log/apache2/<%= @name %>-secure-access.log combined
156   ErrorLog /var/log/apache2/<%= @name %>-secure-error.log
157
158   DocumentRoot <%= @directory %>
159
160   php_admin_value open_basedir <%= @directory %>/:/usr/share/php/:/tmp/
161   #php_admin_value disable_functions "exec,shell_exec,system,passthru,popen,proc_open"
162   php_value memory_limit 128M
163   php_value max_execution_time 240
164   php_value upload_max_filesize 70M
165   php_value post_max_size 100M
166
167   RedirectMatch 301 ^/$                           /wiki/Main_Page
168
169   #Historical Compatibility Links
170   RedirectMatch 301 ^/index\.php$                 /w/index.php
171   RedirectMatch 301 ^/index\.php/(.*)$            /wiki/$1
172   RedirectMatch 301 ^/skins/(.*)$                 /w/skins/$1
173   RedirectMatch 301 ^/images/(.*)$                /w/images/$1
174   RedirectMatch 301 ^/api\.php$                   /w/api.php
175   RedirectMatch 301 ^/opensearch_desc\.php$       /w/opensearch_desc.php
176
177   Alias /wiki <%= @mediawiki[:directory] %>/index.php
178
179   #Support /pagename -> /wiki/pagename
180   RewriteEngine on
181   RewriteCond %{REQUEST_URI} !^/w/
182   RewriteCond %{REQUEST_URI} !^/wiki/
183   RewriteCond %{REQUEST_URI} !^/index\.php
184   RewriteCond %{REQUEST_URI} !^/skins/
185   RewriteCond %{REQUEST_URI} !^/images/
186   RewriteCond %{REQUEST_URI} !^/api\.php$
187   RewriteCond %{REQUEST_URI} !^/opensearch_desc\.php$
188   RewriteCond %{REQUEST_URI} !^/server-status
189   RewriteCond %{LA-U:REQUEST_FILENAME} !-f
190   RewriteCond %{LA-U:REQUEST_FILENAME} !-d
191   RewriteRule ^/(.*) /wiki/$1 [R,L]
192
193   <Directory <%= @directory %>>
194     Options -Indexes
195 <% if node[:lsb][:release].to_f >= 14.04 -%>
196     Require all granted
197 <% end -%>
198   </Directory>
199
200   <Directory <%= @mediawiki[:directory] %>/images/>
201     # No php execution in the upload area
202     php_admin_flag engine off
203     Options -ExecCGI -Includes -Indexes
204     AllowOverride None
205 <% if @mediawiki[:private] -%>
206 <% if node[:lsb][:release].to_f >= 14.04 -%>
207     Require all denied
208 <% else -%>
209     Order allow,deny
210     Deny from all
211 <% end -%>
212 <% end -%>
213   </Directory>
214
215   <Directory <%= @mediawiki[:directory] %>/images/thumb/>
216     RewriteEngine on
217
218     RewriteCond %{REQUEST_FILENAME} !-f
219     RewriteCond %{REQUEST_FILENAME} !-d
220     RewriteRule ^[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /w/thumb.php?f=$1&width=$2 [L,QSA,B]
221
222     RewriteCond %{REQUEST_FILENAME} !-f
223     RewriteCond %{REQUEST_FILENAME} !-d
224     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]
225   </Directory>
226
227   <Directory <%= @mediawiki[:directory] %>/maintenance/>
228 <% if node[:lsb][:release].to_f >= 14.04 -%>
229     Require all denied
230 <% else -%>
231     Order allow,deny
232     Deny from all
233 <% end -%>
234   </Directory>
235
236   <Files <%= @mediawiki[:directory] %>/LocalSettings.php>
237 <% if node[:lsb][:release].to_f >= 14.04 -%>
238     Require all denied
239 <% else -%>
240     Order allow,deny
241     Deny from all
242 <% end -%>
243   </Files>
244
245   <Directory <%= @mediawiki[:directory] %>/images/>
246     Options -ExecCGI -Includes -Indexes
247     AllowOverride None
248     AddType text/plain .html .htm .shtml
249     php_admin_flag engine off
250   </Directory>
251
252   <Directory <%= @mediawiki[:directory] %>/cache/>
253     Options -ExecCGI -Includes -Indexes
254     AllowOverride None
255     AddType text/plain .html .htm .shtml
256     php_admin_flag engine off
257   </Directory>
258
259   <Directory ~ "\.svn">
260 <% if node[:lsb][:release].to_f >= 14.04 -%>
261     Require all denied
262 <% else -%>
263     Order allow,deny
264     Deny from all
265 <% end -%>
266   </Directory>
267
268   <Directory ~ "\.git">
269 <% if node[:lsb][:release].to_f >= 14.04 -%>
270     Require all denied
271 <% else -%>
272     Order allow,deny
273     Deny from all
274 <% end -%>
275   </Directory>
276
277   <Files ~ "~$">
278 <% if node[:lsb][:release].to_f >= 14.04 -%>
279     Require all denied
280 <% else -%>
281     Order allow,deny
282     Deny from all
283 <% end -%>
284   </Files>
285 </VirtualHost>
286 <% end -%>