Nginx hostnames not found at startup in OpenWrt 23.05

Hello,

After upgrading to 23.05, and moving over my old packages from 22.03.3, everything looks fine, except couple of changes in the nginx webserver.

First, modules were not loaded by default, include module.d/*.module was needed to be added.

When I restart the system, and expect nginx to start, but I get this error instead:

Mon Feb 19 08:15:15 2024 daemon.err nginx_init: 2024/02/19 08:15:10 [emerg] 2018#0: host not found in upstream "homelab.lan" in /etc/nginx/conf.d/ha.conf:10
Mon Feb 19 08:15:15 2024 daemon.err nginx_init: nginx: configuration file /etc/nginx/nginx.conf test failed
Mon Feb 19 08:15:15 2024 daemon.err nginx_init: NOT using conf file!
Mon Feb 19 08:15:15 2024 daemon.notice procd: /etc/rc.d/S80nginx: nginx_init: NOT using conf file!
Mon Feb 19 08:15:15 2024 daemon.notice procd: /etc/rc.d/S80nginx: show config to be used by: nginx -T -c '/etc/nginx/nginx.conf'

Keep in mind that when I manage to access the router with SSH, I can manually start the nginx without errors, so this looks a bad scheduling issue, the webserver not having access to the hostnames at its startup. The homelab.lan is also configured in LuCI/Hostnames.

This area is completely unknown to me, and I would be happy to hear your advises before I mess up the configuration.

You are probably using homelab.lan in a proxy_pass directive.
As a quick workaround, you can try using a variable.

    set $homelab homelab.lan;
    proxy_pass http://$homelab;

https://sandro-keil.de/blog/let-nginx-start-if-upstream-host-is-unavailable-or-down/

1 Like

Exactly, it is used in proxy_passes. Thank you for your idea. Do you know what could have changed since 22.03? I didn't check what nginx version I was using there.