Author Topic: nginx does not start automatically  (Read 2618 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
nginx does not start automatically
« 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



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.
« Last Edit: February 16, 2023, 06:13:43 AM by AdventureTime »

Offline
***
Re: nginx does not start automatically
« Reply #1 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



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

Offline
*
Re: nginx does not start automatically
« Reply #2 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 site.

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

Offline
***
Re: nginx does not start automatically
« Reply #3 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

Offline
*
Re: nginx does not start automatically
« Reply #4 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?

Offline
***
Re: nginx does not start automatically
« Reply #5 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

Offline
*****
Re: nginx does not start automatically
« Reply #6 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.