Using Debian 9, the behaviour of systemd is the following:
- At boot-time nginx does not seems to read
/etc/hosts
and failed to start - After boot, when the command
systemctl start nginx
it is working properly
Note: the file /etc/hosts
is correct and remains untouched during all the tests.
After searching for a while, I tried to start systemd-resolved
before nginx. There is no impact.
Oct 13 11:14:01 server-dev systemd-resolved[466]: Positive Trust Anchors:
Oct 13 11:14:01 server-dev systemd-resolved[466]: . IN DS 19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb5
Oct 13 11:14:01 server-dev systemd-resolved[466]: . IN DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d
Oct 13 11:14:01 server-dev systemd-resolved[466]: Negative trust anchors: 10.in-addr.arpa 16.172.in-addr.arpa 17.172.in-addr.arpa 18.172.in-addr.arpa 19.172.in-addr.arpa 20.172.in-addr.arpa 21.172.in-addr.arpa 22.172.in-addr.arpa 23.172
Oct 13 11:14:01 server-dev systemd-resolved[466]: Using system hostname 'server-dev'.
Oct 13 11:14:01 server-dev systemd-resolved[466]: Switching to system DNS server 192.168.1.1.
Oct 13 11:14:01 server-dev shorewall[465]: Compiling using Shorewall 5.0.15.6...
Oct 13 11:14:01 server-dev systemd[1]: Started Network Name Resolution.
Oct 13 11:14:01 server-dev systemd[1]: Starting A high performance web server and a reverse proxy server...
Oct 13 11:14:01 server-dev systemd[1]: Reached target Multi-User System.
Oct 13 11:14:01 server-dev systemd[1]: Reached target Graphical Interface.
Oct 13 11:14:01 server-dev systemd[1]: Starting Update UTMP about System Runlevel Changes...
Oct 13 11:14:01 server-dev systemd[1]: Started Update UTMP about System Runlevel Changes.
Oct 13 11:14:01 server-dev nginx[502]: nginx: [emerg] host not found in upstream "server-dev.com" in /etc/nginx/sites-enabled/default:33
Oct 13 11:14:01 server-dev nginx[502]: nginx: configuration file /etc/nginx/nginx.conf test failed
Oct 13 11:14:01 server-dev systemd[1]: nginx.service: Control process exited, code=exited status=1
Oct 13 11:14:01 server-dev systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Oct 13 11:14:01 server-dev systemd[1]: nginx.service: Unit entered failed state.
Oct 13 11:14:01 server-dev systemd[1]: nginx.service: Failed with result 'exit-code'.
Any suggestion?