]> git.openstreetmap.org Git - chef.git/blob - cookbooks/mediawiki/templates/default/apache.erb
Convert MobileFrontend mediawiki extension to use wfLoadExtension
[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   RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
15   RedirectPermanent / https://<%= @name %>/
16 </VirtualHost>
17
18 <VirtualHost *:443>
19   ServerName <%= @name %>
20 <% @aliases.each do |alias_name| -%>
21   ServerAlias <%= alias_name %>
22 <% end -%>
23
24   ServerAdmin webmaster@openstreetmap.org
25
26   SSLEngine on
27   SSLCertificateFile /etc/ssl/certs/<%= @name %>.pem
28   SSLCertificateKeyFile /etc/ssl/private/<%= @name %>.key
29
30   CustomLog /var/log/apache2/<%= @name %>-secure-access.log combined
31   ErrorLog /var/log/apache2/<%= @name %>-secure-error.log
32
33   DocumentRoot <%= @directory %>
34
35   php_admin_value open_basedir <%= @directory %>/:/usr/share/php/:/tmp/
36   #php_admin_value disable_functions "exec,shell_exec,system,passthru,popen,proc_open"
37   php_value memory_limit 128M
38   php_value max_execution_time 240
39   php_value upload_max_filesize 70M
40   php_value post_max_size 100M
41
42   RewriteCond %{SERVER_NAME} !=<%= @name %>
43   RewriteRule ^/(.*)$ https://<%= @name %>/$1 [R=permanent]
44
45   RedirectMatch 301 ^/$                           /wiki/Main_Page
46
47   #Historical Compatibility Links
48   RedirectMatch 301 ^/index\.php$                 /w/index.php
49   RedirectMatch 301 ^/index\.php/(.*)$            /wiki/$1
50   RedirectMatch 301 ^/skins/(.*)$                 /w/skins/$1
51   RedirectMatch 301 ^/images/(.*)$                /w/images/$1
52   RedirectMatch 301 ^/api\.php$                   /w/api.php
53   RedirectMatch 301 ^/opensearch_desc\.php$       /w/opensearch_desc.php
54
55   Alias /wiki <%= @directory %>/w/index.php
56
57   #Support /pagename -> /wiki/pagename
58   RewriteEngine on
59   RewriteCond %{REQUEST_URI} !^/w/
60   RewriteCond %{REQUEST_URI} !^/wiki/
61   RewriteCond %{REQUEST_URI} !^/index\.php
62   RewriteCond %{REQUEST_URI} !^/skins/
63   RewriteCond %{REQUEST_URI} !^/images/
64   RewriteCond %{REQUEST_URI} !^/api\.php$
65   RewriteCond %{REQUEST_URI} !^/opensearch_desc\.php$
66   RewriteCond %{REQUEST_URI} !^/server-status
67   RewriteCond %{REQUEST_URI} !^/.well-known/
68   RewriteCond %{LA-U:REQUEST_FILENAME} !-f
69   RewriteCond %{LA-U:REQUEST_FILENAME} !-d
70   RewriteRule ^/(.*) /wiki/$1 [R,L]
71
72   <Directory <%= @directory %>>
73     Options -Indexes
74     Require all granted
75   </Directory>
76
77   <Directory <%= @directory %>/w/images/>
78     # No php execution in the upload area
79     php_admin_flag engine off
80     Options -ExecCGI -Includes -Indexes
81     AllowOverride None
82     AddType text/plain .html .htm .shtml
83 <% if @private -%>
84     Require all denied
85 <% end -%>
86   </Directory>
87
88   <Directory <%= @directory %>/w/images/thumb/>
89     RewriteEngine on
90
91     RewriteCond %{REQUEST_FILENAME} !-f
92     RewriteCond %{REQUEST_FILENAME} !-d
93     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
95     RewriteCond %{REQUEST_FILENAME} !-f
96     RewriteCond %{REQUEST_FILENAME} !-d
97     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
99     RewriteCond %{REQUEST_FILENAME} !-f
100     RewriteCond %{REQUEST_FILENAME} !-d
101     RewriteRule ^[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /w/thumb.php?f=$1&width=$2 [L,QSA,B]
102
103     RewriteCond %{REQUEST_FILENAME} !-f
104     RewriteCond %{REQUEST_FILENAME} !-d
105     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]
106   </Directory>
107
108   <Directory <%= @directory %>/w/maintenance/>
109     Require all denied
110   </Directory>
111
112   <Files <%= @directory %>/w/LocalSettings.php>
113     Require all denied
114   </Files>
115
116   <Directory <%= @directory %>/w/cache/>
117     Options -ExecCGI -Includes -Indexes
118     AllowOverride None
119     AddType text/plain .html .htm .shtml
120     php_admin_flag engine off
121   </Directory>
122
123   <Directory ~ "\.svn">
124     Require all denied
125   </Directory>
126
127   <Directory ~ "\.git">
128     Require all denied
129   </Directory>
130
131   <Files ~ "~$">
132     Require all denied
133   </Files>
134 </VirtualHost>