Skip to main content Bumping nginx startup order : r/openwrt
Go to openwrt

Bumping nginx startup order

I've found that nginx doesn't start properly on first boot, with the below error message.

Sat Oct 10 16:21:57 2020 daemon.err nginx_init: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Sat Oct 10 16:21:57 2020 daemon.err nginx_init: 2020/10/10 16:21:57 [emerg] 962#0: bind() to [fd6d:ebd:af31::1]:443 failed (99: Address not available)
Sat Oct 10 16:21:57 2020 daemon.err nginx_init: nginx: configuration file /etc/nginx/nginx.conf test failed
Sat Oct 10 16:21:57 2020 daemon.err nginx_init: NOT using conf file!
Sat Oct 10 16:21:57 2020 daemon.notice procd: /etc/rc.d/S80nginx: nginx_init: NOT using conf file!
Sat Oct 10 16:21:57 2020 daemon.notice procd: /etc/rc.d/S80nginx: show config to be used by: nginx -T -c '/etc/nginx/nginx.conf'

Bumping the startup order from default 80 to 95, placing it just after done, solves the issue, but I'm not loving it.

I imagine some parallel process perhaps isn't fast enough bringing up the interface for nginx to bind to. Now, is this just a limitation of the init system? Would my fix be considered a "proper" one? What else can I perhaps do instead?

TIL ChatGPT can help you learn something new in minutes—whether it's deep dives, quick explanations, or brainstorming ideas. Try it out today. ⬇️
Clickable image which will reveal the video player: TIL ChatGPT can help you learn something new in minutes—whether it's deep dives, quick explanations, or brainstorming ideas. Try it out today. ⬇️
Sort by:
Best
Open comment sort options

I believe it is one of the main reasons why systemd replaced init in most linux distro, to provide concurrent and parallel processing at boot.

Yeah specifically I believe systemd is better able to determine dependencies and only start the next service when its deps are all properly up and running.

More replies

Your fix is probably the correct way to do it, procd doesn't really have strict ordering other than the script filenames.

This change will probably be overwritten by a firmware update unless you build your own images so yeah, if you needed a reason to feel uncomfortable with it, there you go.

Is there any reason you need to bind to a specific address other than to force nginx only on the LAN interface? I understand this is probably a router and you may not want to rely on the firewall.

Is there any reason you need to bind to a specific address other than to force nginx only on the LAN interface?

Just the default settings, I haven't touched any nginx config at all.

More replies
More replies