Articles in this section

nginx does not start automatically after a system reboot on a Plesk for Linux server: 99: Cannot assign requested address

Plesk for Linux kb: technical

Applicable to:

  • Plesk for Linux

Symptoms

  • After system reboot, the websites do not load with the error:

    PLESK_INFO: ERR_ADDRESS_UNREACHABLE

  • nginx service is in the failed state:

    # service nginx status
    ...
      Active: failed (Result: exit-code)
    ...
    server.edhub.net nginx[1104]: nginx: [emerg] bind() to [2400:8901::f03c:91ff:fe24:7893]:443 failed (99: Cannot assign requested address)

  • Manual restart of the service is successful:

    # service nginx start

    # service nginx status | grep Active
    Redirecting to /bin/systemctl status nginx.service
        Active: active (running)

Cause

During the system boot, nginx service was started before IP addresses were assigned to the network interface.

Resolution

RHEL/AlmaLinux-based distributions
  1. Connect to your Plesk server via SSH.
  2. Verify that network interfaces are enabled on system boot:

    # grep -r "ONBOOT" /etc/sysconfig/network-scripts/ifcfg-*

    /etc/sysconfig/network-scripts/ifcfg-lo:ONBOOT=yes
    /etc/sysconfig/network-scripts/ifcfg-venet0:ONBOOT=yes
    /etc/sysconfig/network-scripts/ifcfg-venet0:0:ONBOOT=yes

  3. Create a copy of the nginx startup script /etc/systemd/system/multi-user.target.wants/nginx.service:

    # cp /etc/systemd/system/multi-user.target.wants/nginx.service{,.bak}

  4. Install the systemd-networkd package, if it is not installed:

    # yum install systemd-networkd

  5. Open nginx startup script in a text editor. For example, vi editor:

    # vi /etc/systemd/system/multi-user.target.wants/nginx.service

  6. Add the following line to the [Unit] section:

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

  7. Save the changes and close the file.
  8. Reboot the server:

    # reboot

Debian/Ubuntu-based distributions
  1. Connect to your Plesk server via SSH.
  2. Verify that network interfaces are enabled on system boot:

    # grep auto /etc/network/interfaces

    # This configuration file is auto-generated.
    auto lo
    auto venet0
    auto venet0:0

  3. Create a copy of the nginx startup script /etc/systemd/system/multi-user.target.wants/nginx.service:

    # cp /etc/systemd/system/multi-user.target.wants/nginx.service{,.bak}

  4. Open nginx startup script in a text editor. For example, vi editor:

    # vi /etc/systemd/system/multi-user.target.wants/nginx.service

  5. Add the following line to the [Unit] section:

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

  6. Save the changes and close the file.
  7. Reboot the server:

    # reboot

  8. Check nginx status:

    # service nginx status | grep Active

 

If nginx service did not start after the system restart with the new changes, apply additional step:

  1. Add the following line in [Service] section in /etc/systemd/system/multi-user.target.wants/nginx.service file:

    CONFIG_TEXT: ExecStartPre=/bin/sleep 10

    Note: Increase the value, if 10 seconds timeout is insufficient.

  2. Reboot the server: 

    # reboot

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.