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

auth_basic "Members Only";
auth_basic_user_file /etc/nginx/.htpasswd;

Add below

location ^~ /.well-known/acme-challenge/ {
    auth_basic "off";

Now restart nginx

systemctl restart nginx

See Letsencrypt

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *