I had similar symptoms, but a different configuration. The server runs Debian Wheezy with static IPv4 and IPv6 address configured.
# /etc/network/interfaces
auto lo eth0
iface lo inet loopback
iface eth0 inet static
address 192.0.2.3
netmask 255.255.255.0
gateway 192.0.2.1
iface eth0 inet6 static
address 2001:db8::3
netmask 64
gateway 2001:db8::1
At every boot, nginx failed to start:
bind() to [2001:db8::3]:80 failed (99: Cannot assign requested address)
Manually starting works fine and manual inspection also showed that the addresses and routes are set. Just setting the IPv6 address in interfaces
(without the IPv4 address) worked. Removing the static IPv6 gateway also worked, but then a link-local gateway address is used. After further debugging, I found that the boot process would spit out:
RTNETLINK answers: File exists
Failed to bring up eth0.
It turns out that an IPv6 address and gateway is automatically assigned by the router when the interface is brought up. To avoid this behavior, set accept_ra 0
in the iface eth0 inet6
section. The inet6
section has also to be moved before the inet
section or the default route will still point to the link-local address.
ifconfig
? 2.grep listen /path/to/nginx.conf
?