X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/d352748b416e52cc7174ab6e09f61ef82fa19347..9c3db8b15ab975e975cb31ca8bb388b79f6e5c8e:/cookbooks/mediawiki/templates/default/apache.erb diff --git a/cookbooks/mediawiki/templates/default/apache.erb b/cookbooks/mediawiki/templates/default/apache.erb index 7aed4b3e7..5c38fc0a2 100644 --- a/cookbooks/mediawiki/templates/default/apache.erb +++ b/cookbooks/mediawiki/templates/default/apache.erb @@ -1,7 +1,22 @@ # DO NOT EDIT - This file is being maintained by Chef -<% @ports.each do |port| -%> -> + + ServerName <%= @name %> +<% @aliases.each do |alias_name| -%> + ServerAlias <%= alias_name %> +<% end -%> + + ServerAdmin webmaster@openstreetmap.org + + CustomLog /var/log/apache2/<%= @name %>-access.log combined + ErrorLog /var/log/apache2/<%= @name %>-error.log + +<% if @ssl_enabled -%> + RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/ + RedirectPermanent / https://<%= @name %>/ + + + ServerName <%= @name %> <% @aliases.each do |alias_name| -%> ServerAlias <%= alias_name %> @@ -9,14 +24,12 @@ ServerAdmin webmaster@openstreetmap.org -<% if port == 443 -%> SSLEngine on + SSLCertificateFile /etc/ssl/certs/<%= @name %>.pem + SSLCertificateKeyFile /etc/ssl/private/<%= @name %>.key CustomLog /var/log/apache2/<%= @name %>-secure-access.log combined ErrorLog /var/log/apache2/<%= @name %>-secure-error.log -<% else -%> - CustomLog /var/log/apache2/<%= @name %>-access.log combined - ErrorLog /var/log/apache2/<%= @name %>-error.log <% end -%> DocumentRoot <%= @directory %> @@ -29,11 +42,7 @@ php_value post_max_size 100M RewriteCond %{SERVER_NAME} !=<%= @name %> -<% if port == 443 -%> RewriteRule ^/(.*)$ https://<%= @name %>/$1 [R=permanent] -<% else -%> - RewriteRule ^/(.*)$ http://<%= @name %>/$1 [R=permanent] -<% end -%> RedirectMatch 301 ^/$ /wiki/Main_Page @@ -57,6 +66,7 @@ RewriteCond %{REQUEST_URI} !^/api\.php$ RewriteCond %{REQUEST_URI} !^/opensearch_desc\.php$ RewriteCond %{REQUEST_URI} !^/server-status + RewriteCond %{REQUEST_URI} !^/.well-known/ RewriteCond %{LA-U:REQUEST_FILENAME} !-f RewriteCond %{LA-U:REQUEST_FILENAME} !-d RewriteRule ^/(.*) /wiki/$1 [R,L] @@ -124,4 +134,3 @@ Require all denied -<% end -%>