certbot can't found server block in external config files in nginx

Freebsd 13.1, nginx/1.22.0, certbot 1.29.0

If I use
certbot install --cert-name doman.com
and server block is in /usr/local/etc/nginx/nginx.conf
cerbot install cert correctly

When I move server block to separate files servers/domain.com.conf
and use in main config
http {
[..]
include "servers/*.conf";
}

certbot show
Could not automatically find a matching server block for domain.com. Set the `server_name` directive to use the Nginx installer.

My servers/domain.com.conf is

server {
access_log /var/log/nginx/domain.com.access.log;
error_log /var/log/nginx/domain.com.error.log;
listen 80;
server_name domain.com www.domain.com;

location / {
root /home/user/www/domain.com;
index index.html;
}
}
Of course the website itself (without SSL) works with this configuration.

/usr/local/etc/nginx/servers # ls -al
total 12
drwxr-xr-x 2 root wheel 512 Aug 25 22:19 .
drwxr-xr-x 3 root wheel 512 Aug 25 22:34 ..
-rw-r--r-- 1 root wheel 259 Aug 23 01:00 domain.com.conf

Do you have any idea how to get certbot to run when using separate configuration files in nginx?

certbot -vvvvvvvv install --cert-name domain.com is in attachment but nothing interesting info there.

Best Regards
 

Attachments

It's probably easier if you just supply the webroot directory directly.

certbot install --cert-name domain.com --webroot /home/user/www/domain.com

I don't rely on the Apache or Nginx plugin and just let certbot write to the website's root directly.
 
Back
Top