Skip to content

Instantly share code, notes, and snippets.

@Shaked
Created March 6, 2018 00:23
Show Gist options
  • Save Shaked/0baeae4366f780010715260f951a5002 to your computer and use it in GitHub Desktop.
Save Shaked/0baeae4366f780010715260f951a5002 to your computer and use it in GitHub Desktop.
Enable letsencrypt to access non HTTPS URL when redirecting to HTTPS #SSL
# certbot-auto -n --agree-tos --email='[email protected]' certonly -a webroot --webroot-path=/var/www/html -d domain.com
server {
listen 80;
server_name domain.com;
location ~ /.well-known {
allow all;
root /var/www/html;
}
location / {
return 301 https://domain.com$request_uri;
}
}
server {
listen 443 ssl;
root /var/www/domain.com/web;
index index.php;
server_name domain.com;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;
include snippets/ssl.conf;
...
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment