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
  • 1
  • 2
  • Next
rohanmcdermott
Posts: 11
Joined: Wed May 25, 2016 4:29 pm

nginx failed to restart
  • Quote

Post by rohanmcdermott » Wed Jun 29, 2016 10:18 am

Hi,

Im getting a bunch of emails every day at the same time with the following:

Code: Select all

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Stopping nginx: [FAILED]
Starting nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 127.0.0.1:8084 failed (98: Address already in use)
nginx: [emerg] bind() to (*myip*):443 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 127.0.0.1:8084 failed (98: Address already in use)
nginx: [emerg] bind() to (*myip*):443 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 127.0.0.1:8084 failed (98: Address already in use)
nginx: [emerg] bind() to (*myip*):443 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 127.0.0.1:8084 failed (98: Address already in use)
nginx: [emerg] bind() to (*myip*):443 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 127.0.0.1:8084 failed (98: Address already in use)
nginx: [emerg] bind() to (*myip*):443 failed (98: Address already in use)
nginx: [emerg] still could not bind()
[FAILED]

Could someone please let me know how I could fix this?
Top

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 » Wed Jun 29, 2016 11:54 am

Begin with something like this:

Code: Select all

service apache2 stop
service nginx stop
killall apache2
killall nginx
service nginx start
service apache2 start
PS: OS? VestaCP version?
Top

rohanmcdermott
Posts: 11
Joined: Wed May 25, 2016 4:29 pm

Re: nginx failed to restart
  • Quote

Post by rohanmcdermott » Wed Jun 29, 2016 12:02 pm

Hi,

Thanks for the fast reply.

All commands involving apache2 aren't working (apache2: unrecognised service)

OS: CentOS 6.6
Vesta Ver: 0.9.8-16
Top

rohanmcdermott
Posts: 11
Joined: Wed May 25, 2016 4:29 pm

Re: nginx failed to restart
  • Quote

Post by rohanmcdermott » Wed Jun 29, 2016 12:36 pm

When I do: service httpd restart

I see:

Code: Select all

Starting httpd: [Wed Jun 29 14:35:21 2016] [warn] The Alias directive in /etc/ht
tpd/conf/httpd.conf at line 257 will probably never match because it overlaps an
 earlier Alias.
Top

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 » Wed Jun 29, 2016 4:47 pm

rohanmcdermott wrote:All commands involving apache2 aren't working (apache2: unrecognised service)
apache2 in CentOS has different name - httpd
Top

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 » Wed Jun 29, 2016 4:48 pm

rohanmcdermott wrote:When I do: service httpd restart

Code: Select all

Starting httpd: [Wed Jun 29 14:35:21 2016] [warn] The Alias directive in /etc/ht
tpd/conf/httpd.conf at line 257 will probably never match because it overlaps an
 earlier Alias.
Try to Rebuild Web first.
Top

arharp
Posts: 5
Joined: Fri May 27, 2016 5:29 pm

Re: nginx failed to restart
  • Quote

Post by arharp » Fri Jul 08, 2016 7:37 pm

I'm having a very similar problem. When I stop nginx with "service nginx stop" there aren't any error messages, but nginx continues to run. When I try to restart nginx with "service nginx restart" I get the following:

Code: Select all

root@host:~# 
Job for nginx.service failed. See "systemctl status nginx.service" and "journalctl -xe" for details.
The output for "systemctl status nginx.service" is:

Code: Select all

● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2016-07-08 14:26:57 CDT; 34s ago
  Process: 3002 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
  Process: 2999 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)

Jul 08 14:26:56 host nginx[3002]: nginx: [emerg] bind() to {MYIP}:80 failed (98: Address already in use)
Jul 08 14:26:56 host nginx[3002]: nginx: [emerg] bind() to 127.0.0.1:8084 failed (98: Address already in use)
Jul 08 14:26:56 host nginx[3002]: nginx: [emerg] bind() to {MYIP}:80 failed (98: Address already in use)
Jul 08 14:26:57 host nginx[3002]: nginx: [emerg] bind() to 127.0.0.1:8084 failed (98: Address already in use)
Jul 08 14:26:57 host nginx[3002]: nginx: [emerg] bind() to {MYIP}:80 failed (98: Address already in use)
Jul 08 14:26:57 host nginx[3002]: nginx: [emerg] still could not bind()
Jul 08 14:26:57 host systemd[1]: nginx.service: control process exited, code=exited status=1
Jul 08 14:26:57 host systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Jul 08 14:26:57 host systemd[1]: Unit nginx.service entered failed state.
Jul 08 14:26:57 host systemd[1]: nginx.service failed.
Here are the nginx processes that are running:

Code: Select all

ps -ef | grep nginx
root       405     1  0 14:16 ?        00:00:00 nginx: master process /usr/sbin/nginx
www-data   408   405  0 14:16 ?        00:00:00 nginx: worker process
www-data   409   405  0 14:16 ?        00:00:00 nginx: worker process
www-data   410   405  0 14:16 ?        00:00:00 nginx: cache manager process
root       785     1  0 14:16 ?        00:00:00 nginx: master process /usr/local/vesta/nginx/sbin/vesta-nginx
admin      791   785  0 14:16 ?        00:00:00 nginx: worker process
root      3231  2120  0 14:30 pts/0    00:00:00 grep nginx
If I kill the nginx processes with the following code and then restart nginx it works without any problems.

Code: Select all

pkill nginx && service nginx restart && service vesta restart
However, the next time my server is rebooted I have the same exact issue with nginx failing to restart. Any ideas what could be going on? I've searched all over the web and I'm completely stumped.
Top

arharp
Posts: 5
Joined: Fri May 27, 2016 5:29 pm

Re: nginx failed to restart
  • Quote

Post by arharp » Sat Jul 09, 2016 2:12 am

I should've mentioned that I'm running the Nginx + PHP-FPM configuration. Apache is not installed and I double-checked that there's no apache2.service or httpd.service. When the system starts up it's Nginx that's bound to port 80, I'm just unable to control the instance with the service or systemctl commands.
Top

radardotnet424
Posts: 1
Joined: Mon Jul 18, 2016 9:01 am

Re: nginx failed to restart
  • Quote

Post by radardotnet424 » Mon Jul 18, 2016 9:03 am

rohanmcdermott wrote:Hi,

Im getting a bunch of emails every day at the same time with the following:

Code: Select all

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Stopping nginx: [FAILED] 
Starting nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 127.0.0.1:8084 failed (98: Address already in use)
nginx: [emerg] bind() to (*myip*):443 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 127.0.0.1:8084 failed (98: Address already in use)
nginx: [emerg] bind() to (*myip*):443 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 127.0.0.1:8084 failed (98: Address already in use)
nginx: [emerg] bind() to (*myip*):443 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 127.0.0.1:8084 failed (98: Address already in use)
nginx: [emerg] bind() to (*myip*):443 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 127.0.0.1:8084 failed (98: Address already in use)
nginx: [emerg] bind() to (*myip*):443 failed (98: Address already in use)
nginx: [emerg] still could not bind()
[FAILED]

Could someone please let me know how I could fix this?
Is there any solution?
Last edited by radardotnet424 on Thu Apr 20, 2017 3:48 pm, edited 4 times in total.
Top

arharp
Posts: 5
Joined: Fri May 27, 2016 5:29 pm

Re: nginx failed to restart
  • Quote

Post by arharp » Tue Jul 19, 2016 3:39 pm

I still haven't been able to figure it out. I'm starting to think my only recourse is to start over from scratch.
Top


Post Reply
  • Print view

15 posts
  • 1
  • 2
  • Next

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
 

 

cron

Login  •  Register

I forgot my password