<div dir="ltr"><div>Thank you, Konstantin! I'll investigate those.</div><div><br></div><div>Best regards,</div><div><br></div><div>Aidan</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 29, 2015 at 11:51 AM, Konstantin Pavlov <span dir="ltr"><<a href="mailto:thresh@nginx.com" target="_blank">thresh@nginx.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 29/04/2015 19:49, Konstantin Pavlov wrote:<br>
> Hello Aidan,<br>
><br>
> On 29/04/2015 19:33, Aidan Scheller wrote:<br>
>> Greetings,<br>
>><br>
>> It appears that nginx has difficulties starting automatically in CentOS<br>
>> 7 when it needs to resolve DNS names in the configuration. I'm<br>
>> attributing this to systemd. Nginx stable was installed from packages.<br>
>><br>
>> [admin@nginx ~]$ nginx -v<br>
>> nginx version: nginx/1.8.0<br>
>><br>
>> [admin@nginx ~]$ cat /etc/nginx/conf.d/default.conf<br>
>> server {<br>
>> location / {<br>
>> proxy_pass <a href="http://web01.mycorp.lan:8080" target="_blank">http://web01.mycorp.lan:8080</a>;<br>
>> }<br>
>> }<br>
>><br>
>> When the system boots nginx doesn't start automatically and the<br>
>> logs indicate that it wasn't able to make a DNS query.<br>
>><br>
>> [admin@nginx ~]$ sudo systemctl status nginx.service<br>
>> nginx.service - nginx - high performance web server<br>
>> Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled)<br>
>> Active: failed (Result: exit-code) since Wed 2015-04-29 11:11:42 CDT;<br>
>> 1min 30s ago<br>
>> Docs: <a href="http://nginx.org/en/docs/" target="_blank">http://nginx.org/en/docs/</a><br>
>> Process: 1141 ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf<br>
>> (code=exited, status=1/FAILURE)<br>
>> Apr 29 11:11:42 nginx.mycorp.lan nginx[1141]: nginx: [emerg] host not<br>
>> found in upstream "web01.mycorp.lan...f:38<br>
>> Apr 29 11:11:42 nginx.mycorp.lan nginx[1141]: nginx: configuration file<br>
>> /etc/nginx/nginx.conf test failed<br>
>> Apr 29 11:11:42 nginx.mycorp.lan systemd[1]: nginx.service: control<br>
>> process exited, code=exited status=1<br>
>> Apr 29 11:11:42 nginx.mycorp.lan systemd[1]: Failed to start nginx -<br>
>> high performance web server.<br>
>> Apr 29 11:11:42 nginx.mycorp.lan systemd[1]: Unit nginx.service entered<br>
>> failed state.<br>
>><br>
>> This is the default configuration file for nginx.service in systemd.<br>
>><br>
>> [admin@nginx ~]$ sudo cat /usr/lib/systemd/system/nginx.service<br>
>> Description=nginx - high performance web server<br>
>> Documentation=<a href="http://nginx.org/en/docs/" target="_blank">http://nginx.org/en/docs/</a><br>
>> After=network.target remote-fs.target nss-lookup.target<br>
>><br>
>> I've determined that adding network-online.target resolves the problem<br>
>> and allows nginx to start properly upon boot.<br>
>><br>
>> [admin@nginx ~]$ sudo cat /usr/lib/systemd/system/nginx.service<br>
>> Description=nginx - high performance web server<br>
>> Documentation=<a href="http://nginx.org/en/docs/" target="_blank">http://nginx.org/en/docs/</a><br>
>> After=network.target network-online.target remote-fs.target<br>
>> nss-lookup.target<br>
>> Requires=network-online.target<br>
>><br>
>> Is this a problem that can be addressed by the nginx team?<br>
><br>
> I believe the proper way to fix that issue is:<br>
><br>
> # systemctl enable systemd-networkd-wait-online.service<br>
<br>
</div></div>Or, if one uses NetworkManager:<br>
<br>
# systemctl enable NetworkManager-wait-online.service<br>
<div class="HOEnZb"><div class="h5"><br>
--<br>
Konstantin Pavlov<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</div></div></blockquote></div><br></div>