Create a gist now

Instantly share code, notes, and snippets.

Embed
redirect all http queries to https and allow Let's encrypt challenge.
#
# HTTP: Let's encrypt + redirect on HTTPs
#
<VirtualHost _default_:80>
ServerAdmin yorktown@kulakowski.fr
### Let's encrypt
Alias /.well-known/acme-challenge/ /var/www/challenges/
<Directory "/var/www/challenges">
# Allow open access:
Require all granted
</Directory>
### Redirect to HTTPs
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/
RewriteRule (.*) https://%{HTTP_HOST}$1 [R=301,L]
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment