[Pkg-nginx-maintainers] Bug#861261: nginx.service: Please change "network.target" to "network-online.target"

David Härdeman david at hardeman.nu
Sun Apr 8 18:43:46 BST 2018


Source: nginx
Followup-For: Bug #861261

I was also hit by this bug, nginx refused to start after reboot after
doing a dist-upgrade.

One fix (that I haven't tried) is changing
/proc/sys/net/ipv4/ip_nonlocal_bind and
/proc/sys/net/ipv6/ip_nonlocal_bind.

Temporary fix:

create /etc/systemd/system/nginx.service with the following
content:

.include /lib/systemd/system/nginx.service

[Unit]
After=network-online.target
Wants=network-online.target

Then run "systemctl daemon-reload", and also, according to:
https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/

You might want to run e.g. "systemctl enable
systemd-networkd-wait-online.service" (if you're using networkd).

After that, and a reboot later, nginx is working as expected.

Ideally, the nginx service unit should be changed and nginx itself
should consider using the IP_FREEBIND sockopt functionality (though a
patch to do so seems to have been shot down, see for example:
https://forum.nginx.org/read.php?29,248807,248807#msg-248807 )

-- 
David Härdeman



More information about the Pkg-nginx-maintainers mailing list