skip to Main Content

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.

5

Answers


  1. 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.

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
  3. 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 if you do not specify it manually)

    certbot certonly --nginx --nginx-ctl /usr/local/openresty/nginx/sbin/nginx --nginx-server-root /usr/local/openresty/nginx/conf
    
    Login or Signup to reply.
  4. I had this problem on CentOS 7 and Nginx was probably installed from Epel.
    Renew was working from command line but not from cronjob. I found this in letsencrypt logs: Could not find a usable 'nginx' binary

    So I tried what @Jerther said in a comment, specified --nginx-ctl. First I got the nginx path with: which nginx then I used that returned path /usr/sbin/nginx in the crontab command.

    So in my crontab I replaced:

    /usr/bin/certbot renew

    with

    /usr/bin/certbot --nginx-ctl /usr/sbin/nginx renew

    Login or Signup to reply.
  5. Thanks so much @Jerther and @adrianTNT,

    That fixed the problem! I’ve change

    certbot –nginx-ctl /usr/sbin/nginx renew

    instead of

    certbot renew –nginx

    CentOs 7
    Renew was working from command line but not from cronjob, now it works!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search