[Ubuntu 16.04] nginx won't start on boot while network does not up yet

Bug #1666368 reported by stephon on 2017-02-21

This bug report will be marked for expiration in 59 days if no further activity occurs. (find out why)

This bug affects 1 person
Affects Status Importance Assigned to Milestone
nginx (Ubuntu)

Bug Description

Hi Ubuntu bug report,

After installing nginx and setup done, nginx works normally by "systemctl restart nginx.service"

But nginx won't start on boot.

After running "systemctl status nginx.service", I found that network & dns lookup have not done yet on boot.

nginx should be started after network online and dns lookup working normally, instead of after network.target.

In the attachment, I modified /lib/systemd/system/nginx.service to require network-online.target & nss-lookup.target works normally.

Would you like to merge the patch to nginx package?

Thanks a lot.
Stephon Chen

The attachment "Patch for /lib/systemd/system/nginx.services, let nginx start requiring network-online and nss-lookup work normally." seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Simon Déziel (sdeziel) wrote :

@stephon, the default vhost provided by the package doesn't produce a configuration that requires DNS resolution to start so could you share your nginx/vhost config? Please also share the journalctl entries for nginx.

Changed in nginx (Ubuntu):
status: New → Incomplete
Simon Déziel (sdeziel) wrote :

Also, if your local config does indeed require DNS to be resolvable when nginx starts, I see 2 possible fixes/workarounds for you.

1) you could use a systemd drop-in snippet to tune the startup order like you did in your patch.

2) you could put the IP(s) and DNS name(s) under /etc/hosts. This will only work for static IPs though.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers