Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

nginx failed to restart

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
15 posts
  • Previous
  • 1
  • 2
skurudo
VestaCP Team
Posts: 8099
Joined: Fri Dec 26, 2014 2:23 pm
Contact:
Contact skurudo
Website Facebook Google+ Skype
Twitter

Re: nginx failed to restart
  • Quote

Post by skurudo » Tue Jul 26, 2016 1:09 pm

You can try to look who uses port like this:

Code: Select all

netstat -tulpn | grep :80
Top

cboursinos
Posts: 11
Joined: Thu Dec 15, 2016 2:54 pm

Re: nginx failed to restart
  • Quote

Post by cboursinos » Thu Jan 19, 2017 9:49 pm

Any solution?
Top

noogen
Posts: 66
Joined: Thu Jan 05, 2017 9:20 pm

Re: nginx failed to restart
  • Quote

Post by noogen » Sat Jan 21, 2017 2:02 am

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.
Top

kallovsky
Posts: 19
Joined: Thu Mar 05, 2015 12:00 pm

Re: nginx failed to restart
  • Quote

Post by kallovsky » Thu Sep 05, 2019 8:00 am

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:

Code: Select all

/usr/local/letsencrypt/certbot-auto --standalone renew --pre-hook "service nginx stop" --post-hook "service nginx start"
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.

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

Top

xstocler
Posts: 12
Joined: Thu May 09, 2019 2:28 am

Os: CentOS 6x
Web: nginx + php-fpm
Re: nginx failed to restart
  • Quote

Post by xstocler » Fri Sep 20, 2019 5:21 pm

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
Top


Post Reply
  • Print view

15 posts
  • Previous
  • 1
  • 2

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password