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