# Could not find a usable 'nginx' binary

**URL:** <https://community.letsencrypt.org/t/could-not-find-a-usable-nginx-binary/210300>\
**Category:** Help\
**Created:** [December 18, 2023, 3:36am UTC](https://community.letsencrypt.org/t/could-not-find-a-usable-nginx-binary/210300 "2023-12-18T03:36:23Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![max.mango.tango](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@max.mango.tango](https://community.letsencrypt.org/u/max.mango.tango)\
**Post date:** [December 18, 2023, 3:36am UTC](https://community.letsencrypt.org/t/could-not-find-a-usable-nginx-binary/210300/1 "2023-12-18T03:36:23Z")

</div>

I can't issue certificates for source build nginx 1.24.

I have a hosting and source build nginx.

**Certbot** 2.8.0  
**Ubuntu** 22.04  
**nginx** /1.24.0 - compiled NGINX Open Source from source  
**Domain** : [ambientwhispersmedia.com](http://ambientwhispersmedia.com)  
**Hosting provider** : Digital Ocean

**I can login to a root shell on my machine** : yes  
**I'm using a control panel to manage my site** : no

I used instructions from [nginx.com](http://nginx.com) website: [Installing NGINX Open Source | NGINX Documentation](https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/#compiling-and-installing-from-source)

Nginx configuration options:

```nohighlight
./configure 
--user=nginx 
--group=nginx 
--with-pcre=../pcre2-10.42 
--with-zlib=../zlib-1.3 
--with-http_ssl_module 
--with-http_v2_module 
--with-stream 
--with-http_auth_request_module
--without-http_empty_gif_module
--add-module=../ngx_brotli

```

**My paths** to nginx files in the result:

```nohighlight
  nginx path prefix: "/usr/local/nginx"
  nginx binary file: "/usr/local/nginx/sbin/nginx"
  nginx modules path: "/usr/local/nginx/modules"
  nginx configuration prefix: "/usr/local/nginx/conf"
  nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
  nginx pid file: "/usr/local/nginx/logs/nginx.pid"
  nginx error log file: "/usr/local/nginx/logs/error.log"
  nginx http access log file: "/usr/local/nginx/logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"

```

======

**STEP ONE** - Everything is okey

`snap install core`  
Result:  
core 16-2.60.4 from Canonical✓ installed

`snap refresh core`  
Result:  
snap "core" has no updates available

`snap install --classic certbot`  
Result:  
certbot 2.8.0 from Certbot Project (certbot-eff✓) installed

`ln -s /snap/bin/certbot /usr/bin/certbot`

======

**STEP TWO with errors**

I am installing certbot to have SSL sertificate:

```nohighlight
certbot --nginx -d ambientwhispersmedia.com -d www.ambientwhispersmedia.com

```

**Error** :

```nohighlight
Saving debug log to /var/log/letsencrypt/letsencrypt.log
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.")

```

Second try:

```nohighlight
sudo certbot certonly --nginx -d ambientwhispersmedia.com -d www.ambientwhispersmedia.com

```

**Error** :

```nohighlight
Saving debug log to /var/log/letsencrypt/letsencrypt.log
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.")
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.

```

Third try:

```nohighlight
certbot certonly --nginx --nginx-server-root=/usr/local/nginx -d ambientwhispersmedia.com -d www.ambientwhispersmedia.com

```

**Error** :

```nohighlight
Saving debug log to /var/log/letsencrypt/letsencrypt.log
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.")
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.

```

**I asked for logs** : `tail /var/log/letsencrypt/letsencrypt.log`

Output:

```nohighlight
  File "/snap/certbot/3566/lib/python3.8/site-packages/certbot/_internal/main.py", line 1581, in certonly
    installer, auth = plug_sel.choose_configurator_plugins(config, plugins, "certonly")
  File "/snap/certbot/3566/lib/python3.8/site-packages/certbot/_internal/plugins/selection.py", line 256, in choose_configurator_plugins
    diagnose_configurator_problem("authenticator", req_auth, plugins)
  File "/snap/certbot/3566/lib/python3.8/site-packages/certbot/_internal/plugins/selection.py", line 374, in diagnose_configurator_problem
    raise errors.PluginSelectionError(msg)
certbot.errors.PluginSelectionError: 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.")
2023-12-18 03:12:38,357:ERROR:certbot._internal.log: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.")

```

---

<div class="post-metadata">

**Author:** ![rg305](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/rg305/32/91314_2.png) [@rg305](https://community.letsencrypt.org/u/rg305)\
**Post date:** [December 18, 2023, 3:50am UTC](https://community.letsencrypt.org/t/could-not-find-a-usable-nginx-binary/210300/3 "2023-12-18T03:50:58Z")

</div>

What shows?:  
`set | grep -i path=`

My point is that if you typed "`nginx -t`" in any random location it would likely not find `nginx`.  
Because, even though you compiled `nginx` [from source] on that system, the system itself is unaware of its' existence [globally].  
If so, you might be able to place a symlink somewhere in your path to connect the [global] system to your current `nginx` location: "`/usr/local/nginx/sbin/nginx`"

---

<div class="post-metadata">

**Author:** ![MikeMcQ](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/mikemcq/32/52772_2.png) [@MikeMcQ](https://community.letsencrypt.org/u/MikeMcQ)\
**Post date:** [December 18, 2023, 3:54am UTC](https://community.letsencrypt.org/t/could-not-find-a-usable-nginx-binary/210300/4 "2023-12-18T03:54:50Z")

</div>

Also, the --nginx plugin relies on standard paths by default. You may need to use the below settings for your config.

Or, use --webroot method instead. That does not need the tight interaction with the nginx server as the --nginx plugin requires

[https://eff-certbot.readthedocs.io/en/latest/using.html#certbot-command-line-options](https://eff-certbot.readthedocs.io/en/latest/using.html#certbot-command-line-options)

> nginx:  
> Nginx Web Server plugin
> 
> --nginx-server-root NGINX\_SERVER\_ROOT  
> Nginx server root directory. (default: /etc/nginx or  
> /usr/local/etc/nginx)  
> --nginx-ctl NGINX\_CTL  
> Path to the 'nginx' binary, used for 'configtest' and  
> retrieving nginx version number. (default: nginx)  
> --nginx-sleep-seconds NGINX\_SLEEP\_SECONDS  
> Number of seconds to wait for nginx configuration  
> changes to apply when reloading. (default: 1)

---

<div class="post-metadata">

**Author:** ![rg305](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/rg305/32/91314_2.png) [@rg305](https://community.letsencrypt.org/u/rg305)\
**Post date:** [December 18, 2023, 4:00am UTC](https://community.letsencrypt.org/t/could-not-find-a-usable-nginx-binary/210300/5 "2023-12-18T04:00:31Z")

</div>

I've also used compiled versions of `nginx`.  
But once complied, I generally just move that one single file to `/usr/sbin/`.

---

<div class="post-metadata">

**Author:** ![webprofusion](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/webprofusion/32/85310_2.png) [@webprofusion](https://community.letsencrypt.org/u/webprofusion)\
**Post date:** [December 20, 2023, 3:50am UTC](https://community.letsencrypt.org/t/could-not-find-a-usable-nginx-binary/210300/6 "2023-12-20T03:50:44Z")

</div>

Add the nginx executable location to your PATH (and for any user running cerbot), so that you can just type `nginx -v` and it works.

> <https://github.com/certbot/certbot/blob/master/certbot/certbot/util.py#L204>

---

<div class="post-metadata">

**Author:** ![NetoMeter](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/netometer/32/809_2.png) [@NetoMeter](https://community.letsencrypt.org/u/NetoMeter)\
**Post date:** [December 20, 2023, 6:24am UTC](https://community.letsencrypt.org/t/could-not-find-a-usable-nginx-binary/210300/7 "2023-12-20T06:24:18Z")

</div>

Hi @max.mango.tango

Adding the location of the compiled binary to your path or moving it to the "/usr/sbin" should work.

Since this is not a distribution managed binary (you've compiled it from source), a better location for it would be under "/usr/local/sbin". Therefore, I would suggest to create a symlink for "/usr/local/nginx/sbin/nginx" under "/usr/local/sbin" which is (or should be) by default in your path:

> ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/nginx

---

<div class="post-metadata">

**Author:** ![max.mango.tango](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@max.mango.tango](https://community.letsencrypt.org/u/max.mango.tango)\
**Post date:** [December 20, 2023, 5:52pm UTC](https://community.letsencrypt.org/t/could-not-find-a-usable-nginx-binary/210300/8 "2023-12-20T17:52:45Z")

</div>

What I did:

**1. Added PATH:**

```nohighlight
export PATH=$PATH:/usr/local/nginx/sbin

```

Now command `nginx -t` works in any folder.

**2. I added link:**

```nohighlight
ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/nginx

```

**3. What I tried:**

```nohighlight
certbot certonly --nginx -d ambientwhispersmedia.com -d www.ambientwhispersmedia.com

```

Output:

```nohighlight
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error while running nginx -c /etc/nginx/nginx.conf -t.

nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed

The nginx plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError('Error while running nginx -c /etc/nginx/nginx.conf -t.\n\nnginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)\nnginx: configuration file /etc/nginx/nginx.conf test failed\n')
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.

```

**I tried start certbot with option `--nginx-server-root` and path `/usr/local/sbin/nginx`** :

```nohighlight
certbot certonly --nginx --nginx-server-root=/usr/local/sbin/nginx -d ambientwhispersmedia.com -d www.ambientwhispersmedia.com

```

Output:

```nohighlight
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error while running nginx -c /usr/local/sbin/nginx/nginx.conf -t.

nginx: [emerg] open() "/usr/local/sbin/nginx/nginx.conf" failed (20: Not a directory)
nginx: configuration file /usr/local/sbin/nginx/nginx.conf test failed

The nginx plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError('Error while running nginx -c /usr/local/sbin/nginx/nginx.conf -t.\n\nnginx: [emerg] open() "/usr/local/sbin/nginx/nginx.conf" failed (20: Not a directory)\nnginx: configuration file /usr/local/sbin/nginx/nginx.conf test failed\n')
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.

```

**I checked logs:**

```nohighlight
tail /var/log/letsencrypt/letsencrypt.log

```

Output:

```nohighlight
  File "/snap/certbot/3566/lib/python3.8/site-packages/certbot/_internal/main.py", line 1581, in certonly
    installer, auth = plug_sel.choose_configurator_plugins(config, plugins, "certonly")
  File "/snap/certbot/3566/lib/python3.8/site-packages/certbot/_internal/plugins/selection.py", line 256, in choose_configurator_plugins
    diagnose_configurator_problem("authenticator", req_auth, plugins)
  File "/snap/certbot/3566/lib/python3.8/site-packages/certbot/_internal/plugins/selection.py", line 374, in diagnose_configurator_problem
    raise errors.PluginSelectionError(msg)
certbot.errors.PluginSelectionError: The nginx plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError('Error while running nginx -c /usr/local/sbin/nginx/nginx.conf -t.\n\nnginx: [emerg] open() "/usr/local/sbin/nginx/nginx.conf" failed (20: Not a directory)\nnginx: configuration file /usr/local/sbin/nginx/nginx.conf test failed\n')
2023-12-20 17:41:26,038:ERROR:certbot._internal.log:The nginx plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError('Error while running nginx -c /usr/local/sbin/nginx/nginx.conf -t.\n\nnginx: [emerg] open() "/usr/local/sbin/nginx/nginx.conf" failed (20: Not a directory)\nnginx: configuration file /usr/local/sbin/nginx/nginx.conf test failed\n')

```

**I tried with option and path `/usr/local/nginx/sbin/nginx`:**

```nohighlight
certbot certonly --nginx --nginx-server-root=/usr/local/nginx/sbin/nginx -d ambientwhispersmedia.com -d www.ambientwhispersmedia.com

```

Output:

```nohighlight
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error while running nginx -c /usr/local/nginx/sbin/nginx/nginx.conf -t.

nginx: [emerg] open() "/usr/local/nginx/sbin/nginx/nginx.conf" failed (20: Not a directory)
nginx: configuration file /usr/local/nginx/sbin/nginx/nginx.conf test failed

The nginx plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError('Error while running nginx -c /usr/local/nginx/sbin/nginx/nginx.conf -t.\n\nnginx: [emerg] open() "/usr/local/nginx/sbin/nginx/nginx.conf" failed (20: Not a directory)\nnginx: configuration file /usr/local/nginx/sbin/nginx/nginx.conf test failed\n')
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.

```

**What else can I try?**

---

<div class="post-metadata">

**Author:** ![max.mango.tango](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@max.mango.tango](https://community.letsencrypt.org/u/max.mango.tango)\
**Post date:** [December 20, 2023, 6:41pm UTC](https://community.letsencrypt.org/t/could-not-find-a-usable-nginx-binary/210300/9 "2023-12-20T18:41:03Z")

</div>

My current path for nginx.conf: `/usr/local/nginx/conf/nginx.conf`

certbot is looking this nginx.conf here: `/usr/local/nginx/sbin/nginx/nginx.conf`, and not finding, which is correct.

How can I direct certbot to correct path?

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [December 20, 2023, 6:55pm UTC](https://community.letsencrypt.org/t/could-not-find-a-usable-nginx-binary/210300/10 "2023-12-20T18:55:09Z")

</div>

The `--nginx-server-root` option is actually only used for looking up the configuration file, so you should set it to `/usr/local/nginx/conf/`.

---

<div class="post-metadata">

**Author:** ![max.mango.tango](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@max.mango.tango](https://community.letsencrypt.org/u/max.mango.tango)\
**Post date:** [December 20, 2023, 8:52pm UTC](https://community.letsencrypt.org/t/could-not-find-a-usable-nginx-binary/210300/11 "2023-12-20T20:52:12Z")

</div>

> [@Osiris](#):
>
> `/usr/local/nginx/conf/`

Thank you!

The final command is:

```nohighlight
certbot certonly --nginx --nginx-server-root=/usr/local/nginx/conf/ -d ambientwhispersmedia.com -d www.ambientwhispersmedia.com

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/letsencrypt/original/3X/c/a/ca6c06ea1ea201324bba7048c6841ce60236468d.png) [@system](https://community.letsencrypt.org/u/system)\
**Post date:** [January 19, 2024, 8:52pm UTC](https://community.letsencrypt.org/t/could-not-find-a-usable-nginx-binary/210300/12 "2024-01-19T20:52:30Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
