]> git.openstreetmap.org Git - chef.git/blob - cookbooks/wordpress/templates/default/apache.erb
34c25059d659cd84db200dd2e853377a7459ba8a
[chef.git] / cookbooks / wordpress / 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
23   ServerAdmin webmaster@openstreetmap.org
24
25   SSLEngine on
26   SSLCertificateFile /etc/ssl/certs/<%= @name %>.pem
27   SSLCertificateKeyFile /etc/ssl/private/<%= @name %>.key
28
29   CustomLog /var/log/apache2/<%= @name %>-access.log combined
30   ErrorLog /var/log/apache2/<%= @name %>-error.log
31 <% end -%>
32
33   DocumentRoot <%= @directory %>
34 <% @urls.each do |url,directory| -%>
35   Alias <%= url %> <%= directory %>
36   <Directory <%= directory %>>
37     AllowOverride None
38     php_admin_flag engine off
39     Require all granted
40   </Directory>
41 <% end -%>
42
43   php_admin_value open_basedir <%= @directory %>/:/usr/share/php/:/tmp/
44   php_admin_value disable_functions "exec,shell_exec,system,passthru,popen,proc_open"
45   php_value upload_max_filesize 70M
46   php_value post_max_size 100M
47
48   <Directory <%= @directory %>>
49     RewriteEngine on
50
51     RewriteRule ^wp-admin/includes/ - [F,L]
52     RewriteRule !^wp-includes/ - [S=3]
53     RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
54     RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
55     RewriteRule ^wp-includes/theme-compat/ - [F,L]
56     RewriteRule ^readme\.html$ [F,L]
57     RewriteCond %{REQUEST_FILENAME} !-f
58     RewriteCond %{REQUEST_FILENAME} !-d
59     RewriteRule . /index.php [L]
60
61     Options -Indexes
62     AllowOverride AuthConfig
63
64     Require all granted
65   </Directory>
66
67   <Files <%= @directory %>/wp-config.php>
68     Require all denied
69   </Files>
70
71   <Directory <%= @directory %>/uploads>
72     AllowOverride None
73     AddType text/plain .html .htm .shtml
74     php_admin_flag engine off
75   </Directory>
76
77   <Directory ~ "\.svn">
78     Require all denied
79   </Directory>
80
81   <Directory ~ "\.git">
82     Require all denied
83   </Directory>
84
85   <Files ~ "\.(txt|md)$">
86     Require all denied
87   </Files>
88
89   <Files ~ "~$">
90     Require all denied
91   </Files>
92 </VirtualHost>