nginx: [emerg] host not found in upstream


after installing Nginx on a new system I have some issues when rebooting the system. Nginx is unable to start and throws this error:

`nginx: [emerg] host not found in upstream "" in /etc/nginx/sites-enabled/test.conf:33`

When I try to ping it works without any issues, I also can start the Nginx service manually. Is it possible that Nginx tries to start before the system can resolve host names?

3 thoughts on “nginx: [emerg] host not found in upstream”

  1. What distro are you using? I encountered this issue with the nginx package in Debian Stretch. It bundled a systemd service file for nginx that had an `` dependency, so it tried to start the nginx service before the network was fully available/working. Nginx then wasn’t able to resolve the upstream domain into an IP address and failed to start.

    After overriding the service file so it has `` dependency instead, nginx was able to start upon reboot reliably.


Leave a Comment