Control Web Panel

WebPanel => CentOS-WebPanel Bugs => Topic started by: AdventureTime on February 16, 2023, 06:06:14 AM

Title: nginx does not start automatically
Post by: AdventureTime on February 16, 2023, 06:06:14 AM
It started when I updated the repo, then even when I updated the entire server using dnf upgrade -y

(https://i.imgur.com/jL5F38W.png)

Code: [Select]
● nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2023-02-15 17:29:03 EST; 7h ago
  Process: 779 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)
  Process: 776 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)

Feb 15 17:29:02 racknerd-f5**** systemd[1]: Starting The nginx HTTP and reverse proxy server...
Feb 15 17:29:02 racknerd-f5**** nginx[779]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Feb 15 17:29:03 racknerd-f5**** nginx[779]: nginx: [emerg] bind() to 100.xx.xx.xx:80 failed (99: Cannot assign requested address)
Feb 15 17:29:03 racknerd-f5**** nginx[779]: nginx: configuration file /etc/nginx/nginx.conf test failed
Feb 15 17:29:03 racknerd-f5**** systemd[1]: nginx.service: Control process exited, code=exited status=1
Feb 15 17:29:03 racknerd-f5**** systemd[1]: nginx.service: Failed with result 'exit-code'.
Feb 15 17:29:03 racknerd-f5**** systemd[1]: Failed to start The nginx HTTP and reverse proxy server.

What are your thoughts about it?

It works by starting it manually by pressing the green start button.
Title: Re: nginx does not start automatically
Post by: PakPos on February 16, 2023, 11:41:00 AM
It started when I updated the repo, then even when I updated the entire server using dnf upgrade -y

(https://i.imgur.com/jL5F38W.png)

Code: [Select]
● nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2023-02-15 17:29:03 EST; 7h ago
  Process: 779 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)
  Process: 776 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)

Feb 15 17:29:02 racknerd-f5**** systemd[1]: Starting The nginx HTTP and reverse proxy server...
Feb 15 17:29:02 racknerd-f5**** nginx[779]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Feb 15 17:29:03 racknerd-f5**** nginx[779]: nginx: [emerg] bind() to 100.xx.xx.xx:80 failed (99: Cannot assign requested address)
Feb 15 17:29:03 racknerd-f5**** nginx[779]: nginx: configuration file /etc/nginx/nginx.conf test failed
Feb 15 17:29:03 racknerd-f5**** systemd[1]: nginx.service: Control process exited, code=exited status=1
Feb 15 17:29:03 racknerd-f5**** systemd[1]: nginx.service: Failed with result 'exit-code'.
Feb 15 17:29:03 racknerd-f5**** systemd[1]: Failed to start The nginx HTTP and reverse proxy server.

What are your thoughts about it?

It works by starting it manually by pressing the green start button.


check the bind
Title: Re: nginx does not start automatically
Post by: AdventureTime on February 17, 2023, 08:35:58 AM
Thanks for replying, even though I do not know what BIND is and how to configure it and even how it works.

What I did is the following:

Quote
So you need to tell your linux to allow processes to bind to the non-local address. Just add the following line into /etc/sysctl.conf file:

# allow processes to bind to the non-local address
# (necessary for apache/nginx in Amazon EC2)
net.ipv4.ip_nonlocal_bind = 1
and then reload your sysctl.conf by:

$ sysctl -p /etc/sysctl.conf

which will be fine on reboots.

It is from this (https://stackoverflow.com/questions/3191509/nginx-error-99-cannot-assign-requested-address/13141104#13141104) site.

After I did that, I can restart the server and nginx will automatically start.
Title: Re: nginx does not start automatically
Post by: PakPos on February 18, 2023, 03:23:20 AM
actually if you read the tail -f (the log) you can see that some-domain.tld having error, all you need is remove the dns/zone
or.... maybe just like your case.... BIND
Title: Re: nginx does not start automatically
Post by: AdventureTime on February 20, 2023, 11:25:36 AM
actually if you read the tail -f (the log) you can see that some-domain.tld having error, all you need is remove the dns/zone
or.... maybe just like your case.... BIND

That's weird. I use Cloudflare DNS so I think BIND would be completely bypassed. Right?
Title: Re: nginx does not start automatically
Post by: PakPos on February 21, 2023, 09:43:24 AM
actually if you read the tail -f (the log) you can see that some-domain.tld having error, all you need is remove the dns/zone
or.... maybe just like your case.... BIND

That's weird. I use Cloudflare DNS so I think BIND would be completely bypassed. Right?


^_^ just read the log, then goto dns edit

btw.. that nginx on your server not at CF... right ? even you lock your home then you ask your friend to watch . after that you got fire at some places in side the home.. it's not about your friend... it about your home
Title: Re: nginx does not start automatically
Post by: overseer on March 04, 2023, 04:58:20 PM
nginx is complaining about not being able to bind to the assigned IP address. check that it is correct in the main and vhost config files.