]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/dev/templates/default/apache.rails.erb
Enable SSL for dev apis
[chef.git] / cookbooks / dev / templates / default / apache.rails.erb
index 7301fd83415761ed75b199413d085b2a5cbe7d0d..4eab0d2ee83d4df689d29ee35a4362357c556e58 100644 (file)
@@ -1,22 +1,40 @@
 # DO NOT EDIT - This file is being maintained by Chef
 
-<VirtualHost *:80>
+<VirtualHost *:443>
         ServerName <%= @name %>
 <% @aliases.each do |alias_name| -%>
         ServerAlias <%= alias_name %>
 <% end -%>
         ServerAdmin webmaster@openstreetmap.org
 
-        DocumentRoot /srv/<%= @name %>/public
+        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 /srv/<%= @name %>/public
+
         RailsEnv production
 
         SetEnv SECRET_KEY_BASE <%= @secret_key_base %>
 </VirtualHost>
 
+<VirtualHost *:80>
+        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
+
+        RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
+        RedirectPermanent / https://<%= @name %>/
+</VirtualHost>
+
 <Directory /srv/<%= @name %>/public>
         Require all granted
 </Directory>