nginx does not start automatically

Started by AdventureTime, February 16, 2023, 06:06:14 AM

Previous topic - Next topic

AdventureTime

It started when I updated the repo, then even when I updated the entire server using dnf upgrade -y



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

PakPos

Quote from: 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



● 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

AdventureTime

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:

QuoteSo 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 site.

After I did that, I can restart the server and nginx will automatically start.

PakPos

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

AdventureTime

Quote from: 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

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

PakPos

Quote from: AdventureTime on February 20, 2023, 11:25:36 AM
Quote from: 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

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

overseer

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.