Error :
Received the below error when starting NGINX server,
# /etc/init.d/nginx start
nginx: [emerg] ,bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()
Solution 1:
By default IPv6 TCP socket also accepts IPv4 traffic using the IPv4 structure. Need to disabled IPv6 service or disbaled in configuration file linke below,
listen 80;
listen [::]:80 ipv6only=on default_server;
listen [::]:80 ipv6only=on default_server;
If you will face this error again try to follow the below steps,
Solution 2:
Find PID:
check the Nginx running Process id (PID) using fuser command,
# fuser -n tcp 80
80/tcp: 12943 12955
Stop / Kill :
kill that PID by the below command,
# kill -9 12943
# kill -9 12955
# kill -9 12955
Start Now:
# /etc/init.d/nginx start
Verify the Process:
# ps aux | grep nginx
root 9975 0.1 0.0 5948980 3924 ? Ss 11:14 0:00 nginx: master process /usr/local/sbin/nginx -c /etc/nginx/nginx.conf
nobody 9981 0.2 0.1 5953584 6860 ? S 11:14 0:00 nginx: worker process
nobody 9982 0.0 0.1 5951248 6488 ? S 11:14 0:00 nginx: worker process
nobody 9983 0.0 0.0 5949128 4412 ? S 11:14 0:00 nginx: cache manager process
nobody 9985 0.0 0.0 5949128 4296 ? S 11:14 0:00 nginx: cache loader process
root 10064 0.0 0.0 6372 680 pts/0 S+ 11:14 0:00 grep nginx
Comments (0)