Fix nginx stop- fail nginx – high performance web server

nginx.service – nginx – high performance web server


Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/nginx.service.d
└─php-fpm.conf
Active: failed (Result: exit-code) since Fri 2021-04-09 10:44:03 +07; 3h 50min ago
Docs: http://nginx.org/en/docs/
Process: 2299504 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)
Main PID: 779182 (code=exited, status=0/SUCCESS)

Apr 09 10:44:02 ctr632247.nhanhoa nginx[2299504]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Apr 09 10:44:02 ctr632247.nhanhoa nginx[2299504]: nginx: [emerg] bind() to 0.0.0.0:2992 failed (98: Address already in use)
Apr 09 10:44:02 ctr632247.nhanhoa nginx[2299504]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
Apr 09 10:44:03 ctr632247.nhanhoa nginx[2299504]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Apr 09 10:44:03 ctr632247.nhanhoa nginx[2299504]: nginx: [emerg] bind() to 0.0.0.0:2992 failed (98: Address already in use)
Apr 09 10:44:03 ctr632247.nhanhoa nginx[2299504]: nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
Apr 09 10:44:03 ctr632247.nhanhoa nginx[2299504]: nginx: [emerg] still could not bind()
Apr 09 10:44:03 ctr632247.nhanhoa systemd[1]: nginx.service: Control process exited, code=exited status=1
Apr 09 10:44:03 ctr632247.nhanhoa systemd[1]: nginx.service: Failed with result ‘exit-code’.
Apr 09 10:44:03 ctr632247.nhanhoa systemd[1]: Failed to start nginx – high performance web server.

 

How to fix:

Run :

kill $(ps aux | grep '[n]ginx' | awk '{print $2}')

and restart nginx :

sudo systemctl restart nginx

Most views

Tags: