]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/gps-tile/templates/default/apache.erb
Redirect all gps-tile access to https
[chef.git] / cookbooks / gps-tile / templates / default / apache.erb
index 7572327c3a48b57d6a5fa602266876916f35ab95..064d5628449b8b9987951bdf6feb22f1641c2a8c 100644 (file)
@@ -1,12 +1,18 @@
 # DO NOT EDIT - This file is being maintained by Chef
 
 # DO NOT EDIT - This file is being maintained by Chef
 
-<VirtualHost *:80>
+<VirtualHost *:443>
   # Basic server configuration
   # Basic server configuration
-  ServerName <%= node[:fqdn] %>
-  ServerAlias gps-tile.openstreetmap.org
+  ServerName gps-tile.openstreetmap.org
   ServerAlias *.gps-tile.openstreetmap.org
   ServerAlias *.gps-tile.openstreetmap.org
+  ServerAlias gps.tile.openstreetmap.org
+  ServerAlias gps-*.tile.openstreetmap.org
   ServerAdmin webmaster@openstreetmap.org
 
   ServerAdmin webmaster@openstreetmap.org
 
+  # Enable SSL
+  SSLEngine on
+  SSLCertificateFile /etc/ssl/certs/gps-tile.openstreetmap.org.pem
+  SSLCertificateKeyFile /etc/ssl/private/gps-tile.openstreetmap.org.key
+
   # Configure location of static files
   DocumentRoot /srv/gps-tile.openstreetmap.org/html
 
   # Configure location of static files
   DocumentRoot /srv/gps-tile.openstreetmap.org/html
 
   Header set Access-Control-Allow-Origin "*"
 </VirtualHost>
 
   Header set Access-Control-Allow-Origin "*"
 </VirtualHost>
 
+<VirtualHost *:80>
+  # Basic server configuration
+  ServerName gps-tile.openstreetmap.org
+  ServerAlias *.gps-tile.openstreetmap.org
+  ServerAlias gps.tile.openstreetmap.org
+  ServerAlias gps-*.tile.openstreetmap.org
+  ServerAdmin webmaster@openstreetmap.org
+
+  # Enable rewriting
+  RewriteEngine On
+
+  # Redirect for ACME challenge validation
+  RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
+
+  # Redirect to https
+  RewriteRule (.*) https://%{SERVER_NAME}/$1 [R=permanent,L]
+
+  # Setup logging
+  CustomLog /var/log/apache2/access.log combined
+  ErrorLog /var/log/apache2/error.log
+  BufferedLogs on
+</VirtualHost>
+
 <Directory /srv/gps-tile.openstreetmap.org/html>
   Options None
   AllowOverride None
 <Directory /srv/gps-tile.openstreetmap.org/html>
   Options None
   AllowOverride None
-  Order allow,deny
-  Allow from all
+  Require all granted
+</Directory>
+
+<Directory /srv/gps-tile.openstreetmap.org/updater>
+  <Files tile>
+    Require all granted
+  </Files>
 </Directory>
 </Directory>