• 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

Resolved Nginx not automatically starting

occinodo

Basic Pleskian
Since applying all package updates from the plesk control panel the Nginx service is not automatically starting after a reboot.

Running "chkconfig nginx on" doesn't change anything on this matter.

I'm running CentOS Linux 7.4.1708 and Plesk Onyx Version 17.5.3 Update #23

Any help on this would be greatly appreciated.
 
Nginx didn start after reboot if as vendor php used remi-php56
Have you tried to find the reason of this issue with this customization (non-OS vendor's PHP )?
 
I posted a watchdog in this thread

Issue - Nginx not starting after reboot

I'm using the same script (only different symbolic link) for nginx, redis and mysql

Create folder /etc/cron.5min and modify /etc/crontab so it will run scripts there every 5 minutes

Code:
grep -q '^ *\*/5' /etc/crontab || mkdir /etc/cron.5min && echo -e "\n*/5  *  *   *   * root   cd / && run-parts /etc/cron.5min" >/etc/crontab
*/5  *  *   *   * root   cd / && run-parts /etc/cron.5min

Create the script I posted there (I don't want to maintain double posts) in /usr/local/sbin/

Create a symbolic link for nginx to that script in /etc/cron.5min

Code:
ln -s /usr/local/sbin/watch-process /etc/cron.5min/watch-nginx

After a reboot it will, within 5 minutes, have started nginx if it's not running.....


It works for daemons that run their process as a special user...
 
I posted a watchdog in this thread

Issue - Nginx not starting after reboot

I'm using the same script (only different symbolic link) for nginx, redis and mysql

Create folder /etc/cron.5min and modify /etc/crontab so it will run scripts there every 5 minutes

Code:
grep -q '^ *\*/5' /etc/crontab || mkdir /etc/cron.5min && echo -e "\n*/5  *  *   *   * root   cd / && run-parts /etc/cron.5min" >/etc/crontab
*/5  *  *   *   * root   cd / && run-parts /etc/cron.5min

Create the script I posted there (I don't want to maintain double posts) in /usr/local/sbin/

Create a symbolic link for nginx to that script in /etc/cron.5min

Code:
ln -s /usr/local/sbin/watch-process /etc/cron.5min/watch-nginx

After a reboot it will, within 5 minutes, have started nginx if it's not running.....


It works for daemons that run their process as a special user...

thank you for this solution

but there is one another thing

just now have checked with clean install

‪CentOS Linux 7.4.1708 and Plesk Onyx Version 17.5.3 Update #24
Code:
# yum -y update
# yum -y install epel-release
# sh <(curl https://installer.plesk.com/one-click-installer || wget -O - https://installer.plesk.com/one-click-installer)
nginx not starting after reboot
in this case the announcement
CentOS 7.4 and Red Hat Enterprise Linux 7.4 are now supported.
in
Plesk Onyx 17.5.3 Update 23 Changes Log

!!! was premature !!!
 
Last edited:
found solution on other forum and its work
create the file: /etc/sysctl.d/80-network.conf
with the following contents:

Code:
net.ipv4.ip_nonlocal_bind = 1
net.ipv6.ip_nonlocal_bind = 1

for me ipv6 was enough
Code:
net.ipv6.ip_nonlocal_bind = 1
 
Last edited:
Despite us not having any issues at all after upgrading to CentOS 7.4.1708 before the Plesk Update #23 was released... this thread made us double check(!) We already did and still can, re-boot our server without any nginx start up issues. Hopfully that will still be the case, when Plesk deal with the TLS1.3 / later nginx release requirements and these are then supported by them.
 
Despite us not having any issues at all after upgrading to CentOS 7.4.1708 before the Plesk Update #23 was released... this thread made us double check(!) We already did and still can, re-boot our server without any nginx start up issues. Hopfully that will still be the case, when Plesk deal with the TLS1.3 / later nginx release requirements and these are then supported by them.
Do you have checked on fresh install of Centos 7.4?
(not upgrade from 7.3 to 7.4)
have installed on 3 different VPS (fresh install Centos 7.4 + Plesk Onyx update#24). same result , nginx did not start .
 
Do you have checked on fresh install of Centos 7.4? (not upgrade from 7.3 to 7.4)
No, but only because a fresh install and subsequent re-configuarion of CentOS 7.4 would have been a LOT more work than running the upgrade for us.
 
For those who have problems with nginx start on centos 7 after reboot, and seeing this error: Cannot assign requested address in nginx logs, there is a fix:

cat /lib/systemd/system/nginx.service |sed 's/network.target/network-online.target/g' > /etc/systemd/system/nginx.service && systemctl daemon-reload

This way nginx service will always start after the network is up and online. Useful in virtual environments.
 
For those who have problems with nginx start on centos 7 after reboot, and seeing this error: Cannot assign requested address in nginx logs, there is a fix:

cat /lib/systemd/system/nginx.service |sed 's/network.target/network-online.target/g' > /etc/systemd/system/nginx.service && systemctl daemon-reload

This way nginx service will always start after the network is up and online. Useful in virtual environments.

Hi JTRipper, thanks for your comment, since another server of us got exactly this issue:
2017/10/15 20:42:17 [emerg] 1226#0: bind() to [XXXXXXXXXX]:80 failed (99: Cannot assign requested address)
2017/10/15 20:50:04 [emerg] 1228#0: bind() to [XXXXXXX]:80 failed (99: Cannot assign requested address)
2017/10/15 22:53:44 [alert] 2531#0: *41 open socket #24 left in connection 11
2017/10/15 22:53:44 [alert] 2531#0: aborting
2017/10/15 20:54:12 [emerg] 1218#0: bind() to [XXXXXXX]:80 failed (99: Cannot assign requested address)
2017/10/15 20:59:43 [emerg] 1198#0: bind() to [XXXXXXX]:80 failed (99: Cannot assign requested address)

Is there any way in which I can check if your suggested command was applied successfully?
 
Hi JTRipper, thanks for your comment, since another server of us got exactly this issue:
2017/10/15 20:42:17 [emerg] 1226#0: bind() to [XXXXXXXXXX]:80 failed (99: Cannot assign requested address)
2017/10/15 20:50:04 [emerg] 1228#0: bind() to [XXXXXXX]:80 failed (99: Cannot assign requested address)
2017/10/15 22:53:44 [alert] 2531#0: *41 open socket #24 left in connection 11
2017/10/15 22:53:44 [alert] 2531#0: aborting
2017/10/15 20:54:12 [emerg] 1218#0: bind() to [XXXXXXX]:80 failed (99: Cannot assign requested address)
2017/10/15 20:59:43 [emerg] 1198#0: bind() to [XXXXXXX]:80 failed (99: Cannot assign requested address)

Is there any way in which I can check if your suggested command was applied successfully?
To allow daemons to bind to non-existing network interfaces, and thus avoid this problem, create the file: /etc/sysctl.d/80-network.conf with the following contents:
Code:
net.ipv6.ip_nonlocal_bind = 1
 
Back
Top