]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/serverinfo/templates/default/apache.erb
Teach serverinfo about site aliases
[chef.git] / cookbooks / serverinfo / templates / default / apache.erb
index 04e4a67972764895ae9c11a2289feabd0cb3b251..309f59550aaee9fb562264e2e9144c3678485665 100644 (file)
@@ -1,30 +1,52 @@
 # DO NOT EDIT - This file is being maintained by Chef
 
 <VirtualHost *:80>
-   ServerName <%= @name %>
-   ServerAdmin webmaster@openstreetmap.org
+  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
+  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/
-   Redirect permanent / https://<%= @name %>/
+  RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
+  Redirect permanent / https://<%= @name %>/
 </VirtualHost>
+<% unless @aliases.empty? -%>
 
 <VirtualHost *:443>
-   ServerName <%= @name %>
-   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/<%= @name %>-access.log combined
-   ErrorLog /var/log/apache2/<%= @name %>-error.log
+  SSLEngine on
+  SSLCertificateFile /etc/ssl/certs/<%= @name %>.pem
+  SSLCertificateKeyFile /etc/ssl/private/<%= @name %>.key
 
-   SSLEngine on
-   SSLCertificateFile /etc/ssl/certs/<%= @name %>.pem
-   SSLCertificateKeyFile /etc/ssl/private/<%= @name %>.key
+  CustomLog /var/log/apache2/<%= @name %>-access.log combined
+  ErrorLog /var/log/apache2/<%= @name %>-error.log
 
-   DocumentRoot <%= @directory %>
+  RedirectPermanent / https://<%= @name %>/
+</VirtualHost>
+<% end -%>
+
+<VirtualHost *:443>
+  ServerName <%= @name %>
+  ServerAdmin webmaster@openstreetmap.org
+
+  CustomLog /var/log/apache2/<%= @name %>-access.log combined
+  ErrorLog /var/log/apache2/<%= @name %>-error.log
+
+  SSLEngine on
+  SSLCertificateFile /etc/ssl/certs/<%= @name %>.pem
+  SSLCertificateKeyFile /etc/ssl/private/<%= @name %>.key
+
+  DocumentRoot <%= @directory %>
 </VirtualHost>
 
 <Directory <%= @directory %>>
-   Require all granted
+  Require all granted
 </Directory>