找不到可用的 'nginx' 二进制文件。确保 nginx 存在,二进制文件是可执行的

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

我正在尝试在我的数字海洋水滴上安装 certbot。我正在使用 ubuntu 20.04 并遵循 https://certbot.eff.org/lets-encrypt/ubuntufocal-nginx.

的说明

我运行sudo certbot --nginx时出现错误。我得到的错误是:

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.")

这是我第一次使用数字海洋等所以请解释解决方案。谢谢。

看起来 certbot snap 包有问题,您可以尝试将其从 snap 中删除,然后使用 apt 重新安装 certbot。

你可以关注this tutorial.

接受的答案对我没有帮助,因为当我从 Ubuntu 18 升级时我的 certbot 已正确安装。但是,我确实通过 运行 以下内容获得了更多有用的调试信息命令:

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

如果输出太冗长,则删除末尾的 -v,无论哪种方式,它都会让您更好地了解错误的根本原因。