Nginx: Resolve problem "bind() to 0.0.0.0:80 failed (98: Address already in use)"
I have a problem in my Nginx on SLES 11 SP3, when i try to restart.
It fails like this:
Stopping nginx: [FAILED] Starting nginx: 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()
Look for nginx process, i found:
#ps -efw | grep nginx root 11614 1 0 08:56 ? 00:00:00 nginx: master process /usr/sbin/nginx nginx 11615 11614 0 08:56 ? 00:00:00 nginx: worker process root 11670 11043 0 08:57 pts/0 00:00:00 grep nginx
Solution
To solve this:
1) kill nginx
killall -9 nginx
2) change /etc/nginx/nginx.conf , enable pid parameter
pid /var/run/nginx.pid;
save and close
3) change /etc/init.d/nginx
NGINX_PID=/var/run/nginx.pid
save and close
4) restart nginx
service nginx restart
Ver também
- NodeJs: Instalando o NodeJs no Linux
- MongoDB: Instalando o MongoDB no Linux
- Nginx: Instalando o Nginx no Linux