]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/stateofthemap/templates/default/apache.jekyll.erb
Merge remote-tracking branch 'github/pull/571'
[chef.git] / cookbooks / stateofthemap / templates / default / apache.jekyll.erb
index 504003df60a9bbe221d8f8c97bc197db7bf4f720..58652608593f5d052cbfe43c0c281f93fd824131 100644 (file)
@@ -1,51 +1,53 @@
 # DO NOT EDIT - This file is being maintained by Chef
 
 <VirtualHost *:80>
 # DO NOT EDIT - This file is being maintained by Chef
 
 <VirtualHost *:80>
-        ServerName <%= @year %>.stateofthemap.org
-        ServerAlias <%= @year %>.stateofthemap.com <%= @year %>.sotm.org
-        ServerAdmin webmaster@openstreetmap.org
+  ServerName <%= @name %>
+<% @aliases.each do |alias_name| -%>
+  ServerAlias <%= alias_name %>
+<% end -%>
+  ServerAdmin webmaster@openstreetmap.org
 
 
-        CustomLog /var/log/apache2/<%= @year %>.stateofthemap.org-access.log combined
-        ErrorLog /var/log/apache2/<%= @year %>.stateofthemap.org-error.log
+  CustomLog /var/log/apache2/<%= @name %>-access.log combined
+  ErrorLog /var/log/apache2/<%= @name %>-error.log
 
 
-        RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
-        RedirectPermanent / https://<%= @year %>.stateofthemap.org/
+  RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
+  RedirectPermanent / https://<%= @name %>/
 </VirtualHost>
 
 </VirtualHost>
 
+<% unless @aliases.empty? -%>
 <VirtualHost *:443>
 <VirtualHost *:443>
-        ServerName <%= @year %>.stateofthemap.com
-        ServerAlias <%= @year %>.sotm.org
-        ServerAdmin webmaster@openstreetmap.org
+  ServerName <%= @aliases.first %>
+<% @aliases.drop(1).each do |alias_name| -%>
+  ServerAlias <%= alias_name %>
+<% end -%>
+  ServerAdmin webmaster@openstreetmap.org
 
 
-        CustomLog /var/log/apache2/<%= @year %>.stateofthemap.org-access.log combined
-        ErrorLog /var/log/apache2/<%= @year %>.stateofthemap.org-error.log
+  SSLEngine on
+  SSLCertificateFile /etc/ssl/certs/<%= @name %>.pem
+  SSLCertificateKeyFile /etc/ssl/private/<%= @name %>.key
 
 
-        SSLEngine on
-        SSLCertificateFile /etc/ssl/certs/<%= @year %>.stateofthemap.org.pem
-        SSLCertificateKeyFile /etc/ssl/private/<%= @year %>.stateofthemap.org.key
+  CustomLog /var/log/apache2/<%= @name %>-access.log combined
+  ErrorLog /var/log/apache2/<%= @name %>-error.log
 
 
-        RedirectPermanent / https://<%= @year %>.stateofthemap.org/
+  RedirectPermanent / https://<%= @name %>/
 </VirtualHost>
 </VirtualHost>
+<% end -%>
 
 <VirtualHost *:443>
 
 <VirtualHost *:443>
-        ServerName <%= @year %>.stateofthemap.org
-        ServerAdmin webmaster@openstreetmap.org
+  ServerName <%= @name %>
+  ServerAdmin webmaster@openstreetmap.org
 
 
-        CustomLog /var/log/apache2/<%= @year %>.stateofthemap.org-access.log combined
-        ErrorLog /var/log/apache2/<%= @year %>.stateofthemap.org-error.log
+  CustomLog /var/log/apache2/<%= @name %>-access.log combined
+  ErrorLog /var/log/apache2/<%= @name %>-error.log
 
 
-        SSLEngine on
-        SSLCertificateFile /etc/ssl/certs/<%= @year %>.stateofthemap.org.pem
-        SSLCertificateKeyFile /etc/ssl/private/<%= @year %>.stateofthemap.org.key
+  SSLEngine on
+  SSLCertificateFile /etc/ssl/certs/<%= @name %>.pem
+  SSLCertificateKeyFile /etc/ssl/private/<%= @name %>.key
 
 
-        DocumentRoot /srv/<%= @year %>.stateofthemap.org/_site
+  # Let the backend know we are using HTTPS
+  RequestHeader set X-Forwarded-Proto "https"
+  RequestHeader set X-Forwarded-Port "443"
 
 
-        ErrorDocument 404 /404.html
-
-        ExpiresActive On
-        ExpiresDefault "access plus 10 minutes"
+  ProxyPass / http://localhost:<%= @docker_external_port %>/
+  ProxyPreserveHost on
 </VirtualHost>
 </VirtualHost>
-
-<Directory /srv/<%= @year %>.stateofthemap.org/_site>
-        Require all granted
-</Directory>