Sometimes, when the server load is high, if an script tries to restart Apache, it may happen that Apache does not restart at all, but remains shut down, because due to the excessive server load, the restart process can take an unexpectedly long time, after which systemctl simply gives up reboot.
To prevent this, we need to set the Apache TimeOutStart to a high value.
Code: Select all
sed -i "s|Restart=on-abort|Restart=on-abort\nTimeoutStartSec=900|g" /lib/systemd/system/apache2.service
systemctl restart apache2