Nginx deferred bind

I am using nginx on debian, and have a server configured with

server {
  listen 172.30.0.172 deferred;
}

When I test the nginx config I still get

[emerg] bind() to 172.30.0.172:443 failed (99: Cannot assign requested address)

It's an ssl host, and is using pacemaker for HA, hence why I need to be able to defer the bind


If I'm understanding correctly, you are attempting to make nginx listen on an IP which may or may not exist on the local machine at the time nginx is started, correct?

If so, then the solution lies outside of nginx, as this operation is being disallowed by the Linux kernel.

To allow processes to bind to an IP that doesn't exist you set the net.ipv4.ip_nonlocal_bind sysctl. On Debian/Ubuntu you'd do this:

echo net.ipv4.ip_nonlocal_bind=1 | sudo tee -a /etc/sysctl.conf
sudo sysctl -p