]> git.openstreetmap.org Git - chef.git/blob - cookbooks/wordpress/templates/default/apache.erb
Switch remaining PHP sites to use FPM
[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     Require all granted
39     <FilesMatch ".+\.ph(ar|p|tml)$">
40       SetHandler None
41     </FilesMatch>
42   </Directory>
43 <% end -%>
44
45   ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir=<%= @directory %>/:/usr/share/php/:/tmp/\ndisable_functions=exec,shell_exec,system,passthru,popen,proc_open"
46   ProxyFCGISetEnvIf "true" PHP_VALUE "upload_max_filesize=70M\npost_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     <FilesMatch ".+\.ph(ar|p|tml)$">
75       SetHandler None
76     </FilesMatch>
77   </Directory>
78
79   <Directory ~ "\.svn">
80     Require all denied
81   </Directory>
82
83   <Directory ~ "\.git">
84     Require all denied
85   </Directory>
86
87   <Files ~ "\.(txt|md)$">
88     Require all denied
89   </Files>
90
91   <Files ~ "~$">
92     Require all denied
93   </Files>
94 </VirtualHost>