99: Cannot assign requested address
#Without the IP 10.0.0.3 on the local NIC Nginx will report the following error.
[root@lb01 conf]# /application/nginx/sbin/nginx -t
nginx: the configuration file /application/nginx-1.10.2/conf/nginx.conf syntax is ok
nginx: [emerg] bind() to 10.0.0.3:80 failed (99: Cannot assign requested address)
nginx: configuration file /application/nginx-1.10.2/conf/nginx.conf test failed
[root@lb01 conf]# ip a s eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:27:4e:e9 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.5/24 brd 10.0.0.255 scope global eth0
inet6 fe80::20c:29ff:fe27:4ee9/64 scope link
valid_lft forever preferred_lft forever
#Note: There is no way for nginx to listen to ip addresses that do not exist locally.
solution to nginx monitoring virtual VIP:
The above problem is that there is no IP corresponding to the IP monitored by the configuration file on the physical network card. The solution is to add the following kernel parameter configuration in/etc/sysctl.conf
echo 'net.ipv4.ip_nonlocal_bind = 1' >>/etc/sysctl.conf
sysctl -p# Effective
#You can also make Nginx start up by ignoring the presence of VIPs listening in the configuration with the following method, also suitable for haproxy
echo "1" >/proc/sys/net/ipv4/ip_nonlocal_bind
Similar Posts:
- CentOS starts nginx and prompts nginx: [emergency] still could not bind ()
- [Solved] Nginx Log Error: open() “/opt/Nginx/nginx/nginx.pid” failed (2: No such file or directory)
- Nginx Error: nginx: [emerg] “server” directive is not allowed here in
- [Solved] Nginx restart error: nginx: [error] open() “/run/nginx.pid” failed (2: No such file or directory)
- Nginx Error: Job for nginx.service failed because the control process exited with error code
- [Solved] Nginx Restart Error: nginx: [error] open() “/usr/local/nginx/logs/nginx.pid” failed (2: No such file or directory)
- Nginx Failed to Starup Error: [emerg] mkdir() “/var/tmp/nginx/client” failed (2: No such file or directory)
- [Solved] Nginx: [error] open() "/usr/local/Nginx/logs/Nginx.pid
- Nginx normal user startup configuration error: && springboot-swagger & Unable to infer base url
- PHP FPM and Nginx start normally, page 502 Error [How to Solve]