We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on v1 candidate and expect to engage more with the community over the coming months. We are committed to open source, and we encourage contributors to help us build the future of Vesta.
nginx failed to restart
Re: nginx failed to restart
You can try to look who uses port like this:
Code: Select all
netstat -tulpn | grep :80
Re: nginx failed to restart
Since two process cannot bind to the same port and IP I would try skurudo suggestion and paste the output here. It will show you which process is currently using port 80.
Re: nginx failed to restart
I know that I'm exhuming this thread, but I got a similar problem here and the thread popped out right away when I googled the problem.
I solved it as shown below, but unfortunately just temporarily.
So the problem is that the Nginx restart command seems not to be able to properly kill the server. The server keeps running and if Nginx tries to startup the new instance, the ports are still blocked with the other still running Nginx instance.
I just don't understand why and how this is happening.
I'm also using PHP-FPM, but just on some websites. Also using an external Certbot for Letsencrypt, to handle the ssl cert for the service domain vesta is running on. It's called like this:
The certbot didn't do anything the last calls and the Nginx instance problem occurred anyway.
This problem is happening just from time to time, every few month or once a month.
I solved it as shown below, but unfortunately just temporarily.
So the problem is that the Nginx restart command seems not to be able to properly kill the server. The server keeps running and if Nginx tries to startup the new instance, the ports are still blocked with the other still running Nginx instance.
I just don't understand why and how this is happening.
I'm also using PHP-FPM, but just on some websites. Also using an external Certbot for Letsencrypt, to handle the ssl cert for the service domain vesta is running on. It's called like this:
Code: Select all
/usr/local/letsencrypt/certbot-auto --standalone renew --pre-hook "service nginx stop" --post-hook "service nginx start"
This problem is happening just from time to time, every few month or once a month.
Code: Select all
root@one:~# systemctl status nginx.service
● nginx.service - nginx - high performance web server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2019-09-05 07:21:11 CEST; 2h 5min ago
Docs: http://nginx.org/en/docs/
Process: 29384 ExecStop=/bin/kill -s TERM $MAINPID (code=exited, status=0/SUCCESS)
Process: 19280 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)
Main PID: 24679 (code=exited, status=0/SUCCESS)
Here is how I solve it temporarily:
Sep 05 07:21:09 nginx[19280]: nginx: [emerg] bind() to xx.xx.xx.xx:80 failed (98: Address already in use)
Sep 05 07:21:10 nginx[19280]: nginx: [emerg] bind() to xx.xx.xx.xx:443 failed (98: Address already in use)
Sep 05 07:21:10 nginx[19280]: nginx: [emerg] bind() to xx.xx.xx.xx:80 failed (98: Address already in use)
Sep 05 07:21:10 nginx[19280]: nginx: [emerg] bind() to xx.xx.xx.xx:443 failed (98: Address already in use)
Sep 05 07:21:10 nginx[19280]: nginx: [emerg] bind() to xx.xx.xx.xx:80 failed (98: Address already in use)
Sep 05 07:21:11 nginx[19280]: nginx: [emerg] still could not bind()
Sep 05 07:21:11 systemd[1]: nginx.service: Control process exited, code=exited status=1
Sep 05 07:21:11 systemd[1]: Failed to start nginx - high performance web server.
Sep 05 07:21:11 systemd[1]: nginx.service: Unit entered failed state.
Sep 05 07:21:11 systemd[1]: nginx.service: Failed with result 'exit-code'.
root@one:~# netstat -tulpn | grep --color :80
tcp 0 0 xx.xx.xx.xx:80 0.0.0.0:* LISTEN 29611/nginx: master
tcp 0 0 xx.xx.xx.xx:8080 0.0.0.0:* LISTEN 2689/apache2
tcp 0 0 127.0.0.1:8081 0.0.0.0:* LISTEN 2689/apache2
tcp 0 0 0.0.0.0:8083 0.0.0.0:* LISTEN 1070/nginx: master
root@one:~# fuser -k 80/tcp
80/tcp: 29611 29612 29613
root@one:~# kill -9 29611
-bash: kill: (29611) - No such process
root@one:~# kill -9 1070
root@one:~# service nginx start
Re: nginx failed to restart
I have a similar problem.
Use centos7 with nginx + php-fpm with php7
I have 3 domains in the vestacp panel
For some reason I don't know which one, if I restart the nginx service it won't start. presenting error similar to what was indicated in previous posts.
The only solution I found not to leave the site down.
delete 2 other domains other than the main one (1st added) and start the nginx service
Right after adding the other 2 domains and everything is normalized.
To this day I couldn't figure out why, I keep doing it when I need to restart vestacp
Use centos7 with nginx + php-fpm with php7
I have 3 domains in the vestacp panel
For some reason I don't know which one, if I restart the nginx service it won't start. presenting error similar to what was indicated in previous posts.
The only solution I found not to leave the site down.
delete 2 other domains other than the main one (1st added) and start the nginx service
Right after adding the other 2 domains and everything is normalized.
To this day I couldn't figure out why, I keep doing it when I need to restart vestacp