Letsencrypt Nginx Binary Error

How to solve the letsencrypt nginx binary error? Attempting to renew cert (DOMAIN.TLD) from /etc/letsencrypt/renewal/DOMAIN.TLD.conf produced an unexpected error: 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.“,). Skipping.

Letsencrypt Nginx Binary Error

Solution

Check your PATH variables. In my case /usr/sbin was missing. Therefore the letsencrypt nginx binary error occured. That directory includes the nginx executable. If the path is not declared, letsencrypt can’t find the nginx executable.

mattionline:~# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
mattionline:~# nano /etc/crontab
mattionline:~# PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
mattionline:~# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

After the solution for cron you can also use it for your own user:

https://stackoverflow.com/questions/14637979/how-to-permanently-set-path-on-linux-unix

nano /root/.profile

# add this at the end
export PATH="$PATH:/usr/sbin"

Why it is still not working:

A normal user change with su is not changing all of the environment. A su – does it. These are complete different PATH variables:

Try to renew your ssl certificates:

/root/letsencrypt/letsencrypt-auto renew

In my case some errors occurred, because some configs authorize by standalone (webserver is spawned) and some by nginx directly. I wanted to make it consistent.

Replace the standalone to the nginx version for the letsencrypt verification:

mattionline:/etc/letsencrypt/renewal# sed -i -- 's/standalone/nginx/g' *

After that i got some errors, because some domains were quit and could not be verified by the dns a record.

rm /etc/letsencrypt/renewal/DOMAIN.TLD.conf
systemctl restart nginx

After the removal of those deprecated config files an a webserver restart, everything worked fine.

Alternative: When switching the user via ssh use „ssh – root“. With the „-“ parameter the environment variables including the path variable is set correctly from the bash file.

1 Kommentar zu „Letsencrypt Nginx Binary Error“

Kommentar verfassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Nach oben scrollen