Could not find a usable 'nginx' binary. Ensure nginx exists, the binary is executable

Viewed 5813

I'm trying to install certbot on my digital ocean droplet. I'm using ubuntu 20.04 and following instructions from https://certbot.eff.org/lets-encrypt/ubuntufocal-nginx.

The error occurs when I run sudo certbot --nginx. The error I get is:

The nginx plugin is not working; there may be problems with your existing configuration.
The error was: NoInstallationError("Could not find a usable 'nginx' binary. 
Ensure nginx exists, the binary is executable, and your PATH is set correctly.")

This is my first time using digital ocean and such so please explain the solution. Thank you.

3 Answers

you can use options to specify the path to the 'nginx' binary and conf directory (it seems that certbot expects nginx.conf file in nginx's installation directory)

certbot certonly --nginx --nginx-ctl /usr/local/openresty/nginx/sbin/nginx --nginx-server-root /usr/local/openresty/nginx/conf

looks like theres problem with certbot snap package, you can try to remove it from snap, and install certbot again with apt.

you can follow this tutorial.

The accepted answer didn't help me as my certbot was installed correctly when I upgraded from Ubuntu 18. I did, however, manage to get more useful debugging information by running the following command:

sudo /usr/bin/certbot renew --nginx --debug-challenges -v

If the output of that is too verbose then remove the -v at the end, either way it should give you much better insight as to what the root cause of the error is.

Related