nginx does not start automatically, what have I done?

nginx at onekarlo.com nginx at onekarlo.com
Thu Feb 16 15:13:59 UTC 2023


Hello,

Thanks for replying. I appreciate the thorough response!
I found the solution online.
And it worked!

nano /etc/sysctl.conf # allow processes to bind to the non-local address net.ipv4.ip_nonlocal_bind = 1
sysctl -p /etc/sysctl.conf

What do you think about it?

Thanks.

From: nginx <nginx-bounces at nginx.org> on behalf of Maxim Dounin <mdounin at mdounin.ru>
Date: Thursday, February 16, 2023 at 22:19
To: nginx at nginx.org <nginx at nginx.org>
Subject: Re: nginx does not start automatically, what have I done?
Hello!

On Thu, Feb 16, 2023 at 02:48:23PM +0800, JK wrote:

>    Hello, it is my first time posting here, and I appreciate the
>    opportunity to share my experience with nginx.
>
>
>    Just to give you background, I am using a VPS from Racknerd, and I use
>    CWP (Control Web Panel), which is pretty similar to cPanel.
>
>
>    I tried to update the repo and use dnf upgrade -y, and what happened
>    was, after restarting the server, nginx did not start automatically.
>
>
>    Here is the log of nginx:
>
>
>    ● 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.
>
>
>    The solution is to manually start nginx after a minute or two.

The error message "bind() to 100.xx.xx.xx:80 failed (99: Cannot
assign requested address)" suggests the IP address you are trying
to use is not available when nginx starts.

Possible options to fix this include:

- Make sure nginx systemd service properly depends on the network
  being available (After=/Wants= network-online.target is usually
  good enough, though you may need to also enable proper wait
  service, see [1]).

- Reconfigure nginx to listen on the wildcard address instead, so
  it won't try to bind on IP addresses not yet available when it
  starts.

Hope this helps.

[1] https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx at nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20230216/649a0efa/attachment.htm>


More information about the nginx mailing list