Workaround of race condition between systemd and nginx.
Das, Jagannath
jadas at akamai.com
Wed Dec 30 18:49:06 UTC 2015
How to reproduce this issue?
From: "Daniel K." <dk at syse.no<mailto:dk at syse.no>>
Reply-To: "nginx-devel at nginx.org<mailto:nginx-devel at nginx.org>" <nginx-devel at nginx.org<mailto:nginx-devel at nginx.org>>
Date: Wednesday, December 30, 2015 at 11:58 PM
To: "nginx-devel at nginx.org<mailto:nginx-devel at nginx.org>" <nginx-devel at nginx.org<mailto:nginx-devel at nginx.org>>
Subject: Re: Workaround of race condition between systemd and nginx.
On 12/30/2015 03:50 PM, Gena Makhomed wrote:
On 30.12.2015 16:51, Jim Popovitch wrote:
On Dec 30, 2015 8:46 AM, "Gena Makhomed" <gmm at csdoc.com<mailto:gmm at csdoc.com>> wrote:
Workaround of race condition between systemd and nginx.
Just replace network.target with network-online.target in systemd unit
files.
More details:
http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
From that page, wrt network-online.target:
"It is strongly recommended not to pull in this target too liberally: for
example network server software should generally not pull this in (since
server software generally is happy to accept local connections even before
any routable network interface is up), it's primary purpose is network
client software that cannot operate without network"
nginx now requires configured and up network, before starting daemon.
Replace network.target with network-online.target is easy workaround.
Actually it does not require that at all.
It would be more helpful if you posted your config files, but from your
log file i gather they look something like:
server {
listen 172.22.22.202:80;
[...]
}
And that, due to using systemd, the nginx service gets started before
the network-interface have been configured with the IP address shown.
Two ways you can work around this issue comes to mind.
1) Allow non-local binds
# echo 1 > /proc/sys/net/ipv4/ip_nonlocal_bind
Put 'net.ipv4.ip_nonlocal_bind = 1' in /etc/sysctl.conf to make it stick.
2) Configure nginx to listen to *:80
Add this to your config files somewhere.
server {
listen 80;
}
to your config files somewhere, and nginx will listen to 0.0.0.0:80
instead of every IP address you mention.
Hope that helps,
Daniel K.
_______________________________________________
nginx-devel mailing list
nginx-devel at nginx.org<mailto:nginx-devel at nginx.org>
http://mailman.nginx.org/mailman/listinfo/nginx-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20151230/a726e1df/attachment.html>
More information about the nginx-devel
mailing list