LetsEncrypt SSL On Nginx Password Protected site
When you develop a web site, you will need it password protected so others won’t see or you don’t want google to index the web pages while you are working on it.
To password protect a web site in nginx, see
Nginx Password Protect a website
If you password protect a web site and try to get LetsEncrypt SSL cerificate using webroot verification method, it will fail. We need to disable password protection for url domain/.well-known. To do this, find
1 2 |
auth_basic "Members Only"; auth_basic_user_file /etc/nginx/.htpasswd; |
Add below
1 2 3 |
location ^~ /.well-known/acme-challenge/ { auth_basic "off"; } |
Now restart nginx
1 |
systemctl restart nginx |
See Letsencrypt