Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rolandinsh/b506ba8689f935561aa65514994d4410 to your computer and use it in GitHub Desktop.
Save rolandinsh/b506ba8689f935561aa65514994d4410 to your computer and use it in GitHub Desktop.
nginx-le-https.conf
# Let's Encrypt webroot and https-only server
# via https://community.letsencrypt.org/t/webroot-and-https-only-server-impossible/32506
server {
# SSL configuration
#
listen *:443 ssl http2;
listen [::]:443 ssl http2;
.........
}
server {
listen *:80;
listen [::]:80;
server_name mywebsite.com www/mywebsite.com;
# ACME Challenge Rule
location /.well-known {
alias /var/www/mywebsite.com/.well-known;
allow all;
default_type "text/plain";
autoindex on;
}
location / {
return 301 https://mywebsite.com$request_uri;
}
access_log /var/log/nginx/mywebsite.com-access.log;
error_log /var/log/nginx/mywebsite.com-error.log;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment