• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Nginx won't start after reboot

splatt

New Pleskian
Hi everyone,

After one of the upgrades, nginx is not starting by default after server reboot. However, we can start it manually from the Plesk services page (or by running service nginx start).

This problem we have is covered here: https://kb.plesk.com/en/128261
We have exactly these symptoms, like error (bind() to [xxx.xxx.xxx.xxx]:80 failed (99: Cannot assign requested address)) error in the error log.
However, the solution in this article doesn't work. File "/etc/systemd/system/multi-user.target.wants/nginx.service" doesn't even exist on Debian 7.
I tried to install systemd, but systemctl command says "Failed to get D-Bus connection: No connection to service manager."
It seems that this article doesn't really work for Debian 7.

I tried to search the answer but nothing really worked for me yet. We have the last version of Plesk.

Thanks.
 
It's not a Plesk issue, but an Nginx issue or network management issue with startup scripts of the network adapters. I can confirm the issue for CentOS 7.2. You can try these solutions:

1) Editing /etc/sysconfig/network-scripts/ifcfg-eth0 according to kb.plesk.com/en/128261

2) Add this line as the first line to /etc/init.d/nginx:
while ip -6 addr show tentative | grep . > /dev/null ; do sleep 1 ; done
This ought to test every second whether the IP6 interface has left the tentative state is is now ready for Nginx to bind to it. But for unknown reason it does not work on our machines :-(

3) If your OS has /etc/network/interfaces, add this line to the INET6 block or to the end of the file:
while ip -6 addr show tentative | grep . > /dev/null ; do sleep 1 ; done
This does the same as in (2), but it waits within the network initialization process.

4) Disable duplicate address detection in /etc/sysctl.conf by adding this line to it:
net.ipv6.conf.eth0.dad_transmits=0
This ought to tell the system not to wait on test windows for duplicate address tests.

Reboot system afterwards.

On a default CentOS 7.2 installation none of these concepts is successful, and there is no indication in any log files why none of them works.
 
It's not a Plesk issue, but an Nginx issue or network management issue with startup scripts of the network adapters.

The root cause may be with nginx, but I don't agree with you that it's not a "Plesk Issue".
The whole idea of the Plesk interface is the management of its depending services.

When I write scripts in Linux I try not to interfere with the things Plesk is doing and I want to to trust Plesk in managing these properly.
In the case of nginx and the Plesk Antivirus it seems they didn't.
There is an /etc/init.d/drwebd script created, but there are no Sxx* symbolic links counterparts for it.

For nginx these are all created.
I too thought it was trying to start too early.
But now I don't know... I added a full 5 minute wait to the script and it still didn't start.

None of your suggested solutions work. Partly because they are not applicable (I'm on Ubuntu).
Even a simple addition in /etc/init.d/nginx didn't work.
Code:
uptime | grep -q ' [0-5] min' && sleep 300

I'm now doing a fresh install on a new server because the other (rented) server has ECC memory errors out of the box.
If it does the same I will write a watchdog for both.

Something like:

/etc/cron.5min/watch-nginx
Code:
#!/bin/sh
ps aux | grep -q '^[n]ginx' && exit 0
echo "Watchdog $0 starts nginx" >&2
/etc/init.d/nginx start
 
Last edited:
Back
Top