1 # DO NOT EDIT - This file is being maintained by Chef
2 <% @ports.each do |port| -%>
4 <VirtualHost *:<%= port %>>
5 ServerName <%= @name %>
6 <% @aliases.each do |alias_name| -%>
7 ServerAlias <%= alias_name %>
10 ServerAdmin webmaster@openstreetmap.org
14 SSLCertificateFile /etc/ssl/certs/<%= @name %>.pem
15 SSLCertificateKeyFile /etc/ssl/private/<%= @name %>.key
17 CustomLog /var/log/apache2/<%= @name %>-secure-access.log combined
18 ErrorLog /var/log/apache2/<%= @name %>-secure-error.log
20 CustomLog /var/log/apache2/<%= @name %>-access.log combined
21 ErrorLog /var/log/apache2/<%= @name %>-error.log
24 DocumentRoot <%= @directory %>
26 <% if @ssl_enabled -%>
27 RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
30 php_admin_value open_basedir <%= @directory %>/:/usr/share/php/:/tmp/
31 #php_admin_value disable_functions "exec,shell_exec,system,passthru,popen,proc_open"
32 php_value memory_limit 128M
33 php_value max_execution_time 240
34 php_value upload_max_filesize 70M
35 php_value post_max_size 100M
37 RewriteCond %{SERVER_NAME} !=<%= @name %>
39 RewriteRule ^/(.*)$ https://<%= @name %>/$1 [R=permanent]
41 RewriteRule ^/(.*)$ http://<%= @name %>/$1 [R=permanent]
44 RedirectMatch 301 ^/$ /wiki/Main_Page
46 #Historical Compatibility Links
47 RedirectMatch 301 ^/index\.php$ /w/index.php
48 RedirectMatch 301 ^/index\.php/(.*)$ /wiki/$1
49 RedirectMatch 301 ^/skins/(.*)$ /w/skins/$1
50 RedirectMatch 301 ^/images/(.*)$ /w/images/$1
51 RedirectMatch 301 ^/api\.php$ /w/api.php
52 RedirectMatch 301 ^/opensearch_desc\.php$ /w/opensearch_desc.php
54 Alias /wiki <%= @directory %>/w/index.php
56 #Support /pagename -> /wiki/pagename
58 RewriteCond %{REQUEST_URI} !^/w/
59 RewriteCond %{REQUEST_URI} !^/wiki/
60 RewriteCond %{REQUEST_URI} !^/index\.php
61 RewriteCond %{REQUEST_URI} !^/skins/
62 RewriteCond %{REQUEST_URI} !^/images/
63 RewriteCond %{REQUEST_URI} !^/api\.php$
64 RewriteCond %{REQUEST_URI} !^/opensearch_desc\.php$
65 RewriteCond %{REQUEST_URI} !^/server-status
66 RewriteCond %{REQUEST_URI} !^/.well-known/
67 RewriteCond %{LA-U:REQUEST_FILENAME} !-f
68 RewriteCond %{LA-U:REQUEST_FILENAME} !-d
69 RewriteRule ^/(.*) /wiki/$1 [R,L]
71 <Directory <%= @directory %>>
76 <Directory <%= @directory %>/w/images/>
77 # No php execution in the upload area
78 php_admin_flag engine off
79 Options -ExecCGI -Includes -Indexes
81 AddType text/plain .html .htm .shtml
87 <Directory <%= @directory %>/w/images/thumb/>
90 RewriteCond %{REQUEST_FILENAME} !-f
91 RewriteCond %{REQUEST_FILENAME} !-d
92 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]
94 RewriteCond %{REQUEST_FILENAME} !-f
95 RewriteCond %{REQUEST_FILENAME} !-d
96 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]
98 RewriteCond %{REQUEST_FILENAME} !-f
99 RewriteCond %{REQUEST_FILENAME} !-d
100 RewriteRule ^[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /w/thumb.php?f=$1&width=$2 [L,QSA,B]
102 RewriteCond %{REQUEST_FILENAME} !-f
103 RewriteCond %{REQUEST_FILENAME} !-d
104 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]
107 <Directory <%= @directory %>/w/maintenance/>
111 <Files <%= @directory %>/w/LocalSettings.php>
115 <Directory <%= @directory %>/w/cache/>
116 Options -ExecCGI -Includes -Indexes
118 AddType text/plain .html .htm .shtml
119 php_admin_flag engine off
122 <Directory ~ "\.svn">
126 <Directory ~ "\.git">