Let’s Encrypt – Adding new domain with Certbot (Ubuntu 16.04, nginx)

sudo certbot --nginx -d <domain>

You may encounter the following error after running the above command:

Client with the currently selected authenticator does not support any combination of challenges that will satisfy the CA.

If that is the case, please use the following command instead:

sudo certbot --authenticator standalone --installer nginx -d <domain> --pre-hook "service nginx stop" --post-hook "service nginx start"