Francis,

This is a known issue.  In the nginx community, we actually list the use
of any type of hostname, including localhost, a pitfall, as nginx might
not be able to resolve the hostname at a service restart or at boot
time.  Below is the content of this documentation (which I had a hand in
writing) that details why using hostnames in upstream or listen
statements is bad:
(http://docs.ngx.cc/en/latest/topics/tutorials/config_pitfalls.html#using-a
-hostname-to-resolve-addresses)


Using a Hostname to Resolve Addresses

BAD:

upstream {
    server http://someserver;
}

server {
    listen myhostname:80;
    # [...]
}

You should never use a hostname in a listen directive. While this may
work, it will come with a large number of issues. One such issue being
that the hostname may not resolve at boot time or during a service
restart. This can cause Nginx to be unable to bind to the desired TCP
socket which will prevent Nginx from starting at all.

A safer practice is to know the IP address that needs to be bound to and
use that address instead of the hostname. This prevents Nginx from
needing to look up the address and removes dependencies on external and
internal resolvers.

This same issue applies to upstream locations. While it may not always
be possible to avoid using a hostname in an upstream block, it is bad
practice and will require careful considerations to prevent issues.


GOOD:

upstream {
    server http://10.48.41.12;
}

server {
    listen 127.0.0.16:80;
    # [...]
}

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to nginx in Ubuntu.
https://bugs.launchpad.net/bugs/1447294

Title:
  package nginx-full 1.6.2-5ubuntu3 failed to install/upgrade:
  subprocess installed post-installation script returned error exit
  status 1

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/1447294/+subscriptions

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to