Nginx does not start automatically after reboot: 99: Cannot assign requested address

Follow

Comments

23 comments

  • Avatar
    Aniello Martuscelli

    same problem here on ubuntu 16.04 with onyx

    how can solve there is any patch?

    into logs i've found

    gen 17 02:52:51 host-01 nginx[1977]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

    gen 17 02:52:51 host-01 nginx[1977]: nginx: [emerg] bind() to [2001:41d0:1000:2264::]:80 failed (99: Cannot assign requested address)

    gen 17 02:52:51 host-01 nginx[1977]: nginx: configuration file /etc/nginx/nginx.conf test failed

  • Avatar
    Lev Iurev

    Hi @Aniello, did you try to use this article?

  • Avatar
    Benjamin Hodgetts

    If this is a known issue and the fix is known, why hasn't the fix been implemented into the package itself? (i.e. that network.target should be network-online.target).

  • Avatar
    Lev Iurev

    Hi @Benjamin, because Plesk uses system package from system repo.

  • Avatar
    Benjamin Hodgetts

    Are you sure? Nginx is provided by "sw-nginx-*.rpm" which is your own build (hence the "sw") from your own repos.

  • Avatar
    Jens Wiesser (Edited )

    @Aniello, i got the same Error. 

    # grep "ONBOOT" /etc/sysconfig/network-scripts/ifcfg-eth0

    This ist not working on Ubuntu. This is for CentOS. Any advice to solve this Problem?

    Jan 20 12:03:42 host-xyz systemd[1]: Reached target Network.
    Jan 20 12:03:47 host-xyz systemd[1]: Starting Startup script for nginx service...
    Jan 20 12:03:50 host-xyz nginx[1160]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    Jan 20 12:03:50 host-xyz nginx[1160]: nginx: [emerg] bind() to xxx.xxx.xxx.xxx:80 failed (99: Cannot assign requested address)
    Jan 20 12:03:50 host-xyz nginx[1160]: nginx: configuration file /etc/nginx/nginx.conf test failed
    Jan 20 12:03:50 host-xyz systemd[1]: nginx.service: Control process exited, code=exited status=1
    Jan 20 12:03:50 host-xyz systemd[1]: Failed to start Startup script for nginx service.
    Jan 20 12:03:50 host-xyz systemd[1]: nginx.service: Unit entered failed state.
    Jan 20 12:03:50 host-xyz systemd[1]: nginx.service: Failed with result 'exit-code'.

  • Avatar
    Alexander Tsmokalyuk (Edited )

    @Aniello Thank you for the question. The solution is not implemented in a patch because in the environments where there is no any delay in putting network interfaces up it would make unnecessary delays of OS boot process (i.e. of nginx service).

  • Avatar
    Alexander Tsmokalyuk

    @Benjamin yes, the package is built by us.

  • Avatar
    Aniello Martuscelli

    @Lev Iurev

    I've changed this

    After=network-online.target remote-fs.target nss-lookup.target

    nothing changed, after reboot I should give

    service nginx restart

  • Avatar
    Vitaly Zhidkov

    @Aniello, this should be checked deeper. Please contact you hosting provider and ask them to check it on server level. If it will be necessary they will submit a support ticket for us.

  • Avatar
    Aniello Martuscelli (Edited )

    @Vitaly, I've selfmanaged dedicated from OVH

    They said me that not handle software problems. I've tried to open support ticket on Your site, but my license is not accepted because brought from OVH

    However I've another dedicated server (same hardware 6core, 128gbram, 2xSSD NVMe, ubuntu 16.04) with ISPConfig, but i've this problem only with Plesk Onyx

  • Avatar
    Lev Iurev

    @Aniello, if you've bought Plesk with license from OVH, they should support your issue with Plesk.

  • Avatar
    Benjamin Hodgetts

    "The solution is not implemented in a patch because in the environments where there is no any delay in putting network interfaces up it would make unnecessary delays of OS boot process"

    Surely if there's no delay in putting network interfaces up then network-online wouldn't cause a delay because it's already up, no?

  • Avatar
    Vitaly Zhidkov

    @Benjamin, in case there is no delay in IP assign there would be also no delays in OS boot process.

  • Avatar
    Paolo Bertinetti

    I had this morning the same problem on Plesk Onyx 17.0.17 #29/CentOS Linux 7.3.1611 (Core). This solution was very useful!

    Thanks

  • Avatar
    Klemen Balantič

    This solution is NOT working for me on Plesk Onyx v17.5.3/CentOS Linux 7.4.1708. Can anyone help me?

  • Avatar
    Lev Iurev

    @Klemen, letm me know the error from /var/log/nginx/error.log and journalctl

  • Avatar
    Klemen Balantič

    Than you @Lev, here are errors:

    nginx log file:

    10:07:21 [emerg] 1229#0: bind() to [2a02:c277:2012:6196::1]:443 failed (99: Cannot assign requested address)

    journalctl:

    10:07:19 vps.klemen.com systemd[1]: Starting LSB: Bring up/down networking...
    10:07:20 vps.klemen.com network[638]: Bringing up loopback interface:  [  OK  ]
    10:07:20 vps.klemen.com network[638]: Bringing up interface eth0:  [  OK  ]
    10:07:20 vps.klemen.com systemd[1]: Reached target Network.
    10:07:20 vps.klemen.com systemd[1]: Starting Network.
    10:07:21 vps.klemen.com systemd[1]: Starting Startup script for nginx service...
    10:07:22 vps.klemen.com nginx[1229]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    10:07:22 vps.klemen.com nginx[1229]: nginx: [emerg] bind() to [2a02:c277:2012:6196::1]:443 failed (99: Cannot assign requested address)
    10:07:22 vps.klemen.com nginx[1229]: nginx: configuration file /etc/nginx/nginx.conf test failed
    10:07:22 vps.klemen.com systemd[1]: nginx.service: control process exited, code=exited status=1
    10:07:23 vps.klemen.com systemd[1]: Failed to start Startup script for nginx service.
    10:07:23 vps.klemen.com systemd[1]: Unit nginx.service entered failed state.
    10:07:23 vps.klemen.com systemd[1]: nginx.service failed.

  • Avatar
    Lev Iurev

    @Klemen does 2a02:c277:2012:6196::1 exist on the server?  is there another service llistening on the port netstat -tulpn | grep 443

    Issue persists on the server reboot or nginx could not be started at all?

  • Avatar
    Klemen Balantič


    [root@vps ~]# netstat -tulpn | grep 443
    tcp 0 0 5.173.175.128:443 0.0.0.0:* LISTEN 2268/nginx: master
    tcp 0 0 0.0.0.0:8443 0.0.0.0:* LISTEN 991/sw-cp-server: m
    tcp6 0 0 2a02:c277:2012:6196:443 :::* LISTEN 2268/nginx: master
    tcp6 0 0 :::8443 :::* LISTEN 991/sw-cp-server: m

    Issue exists only on server reboot, I have to start nginx manually and then it's working

  • Avatar
    Bulat Tsydenov

    @Klemen, I would recommend you contact our support https://www.plesk.com/contact-support in this case as the issue you have needs deeper investigation.

  • Avatar
    Esoares (Edited )

    This solution is not working for Plesk Onyx on Ubuntu 16.04 over AWS EC2.

     

    The only way that I've found to solve it is enabling auto restart on nginx process:

    Adding this to `[Service]` section of `/etc/systemd/system/multi-user.target.wants/nginx.service` solves the problem.

    # Avoid problem with nginx not starting right after a reboot
    Restart=always
    RestartSec=5

    ---- Edit ----

    Maybe this problem is related with docker network, since this just happens on my instance that use docker containers, aparently the `network-online.target` is ready after the first interface boots (docker one, probably)

    As this answer on Stackoverflow says, this can be fixed by installing the `ifupdown` package. Didn't tested yet, but if this is true, then it should be implemented by default on Plesk!

    ---- Edit ----

    Investigating more, I've found that a service `ifup@` exists, but only watches to eth0 interface, not to docker interfaces. Since I use proxy to docker on some domains, nginx fails to bind to the docker ip since it's not ready yet. So implementing the solution of stackoverflow above should work, making unecessary to add the auto-restart on nginx service.

  • Avatar
    Robert Asilbekov

    @Esoares Thank you for sharing your feedback.

Please sign in to leave a comment.

Have more questions? Submit a request