Created
March 6, 2018 00:23
-
-
Save Shaked/0baeae4366f780010715260f951a5002 to your computer and use it in GitHub Desktop.
Enable letsencrypt to access non HTTPS URL when redirecting to HTTPS #SSL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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