How To fix Error 404 while trying to set up HTTPS with Let’s Encrypt

1)Remove the IP6 entries in NS records

2)Use below settings

location ~ ^/.well-known {
root /var/www/html/example.com/; #
allow all;
}

3) use webroot

certbot certonly –webroot -w /var/www/html/example.com / -d www. example.com -d example.com

4) sudo certbot –nginx