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

Advertisement

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
Add a comment

Leave a Reply

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

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement