Applicable to:
- Plesk for Linux
-
Nginx and Apache don't start automatically after a server reboot
-
The journal shows timeout errors during startup:
# journalctl -u apache2 -u httpd -u nginx -b
systemd[1]: httpd.service start operation timed out. Terminating.
systemd[1]: nginx.service start-pre operation timed out. Terminating. -
The services can be started manually without issues
Cause
The timeout value of the services is too low, and they don't have enough time to start.
Resolution
Increase the Apache and nginx service timeout.
-
Log in over SSH
-
Run this command to backup the startup scripts and update the timeout value:
# for s in /usr/lib/systemd/system/{nginx,httpd,apache2}.service; do [ -f "$s" ] && cp -au "$s"{,.bak} && sed -i '/^[Service]/,/^[/{/^TimeoutStartSec=/{h;s/=.*/=600/};t;s/([Service])/\1\nTimeoutStartSec=600/}' $s; done
Comments
0 comments
Please sign in to leave a comment.