Applicable to:
- Plesk for Linux
-
Nginx, Apache or other services do(es) not start automatically after a server reboot.
-
Service(s) can be started manually without issues:
# service nginx start
Starting nginx (via systemctl): [ OK ] -
Apache service is in failed status:
# service httpd status
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/httpd.service.d
L-limit_nofile.conf
Active: failed (Result: signal) since Thu 2017-07-22 13:44:27 CEST; 58s ago
Process: 55266 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=killed, signal=KILL)
Main PID: 55266 (code=killed, signal=KILL)
...
systemd[1]: Starting The Apache HTTP Server...
systemd[1]: httpd.service start operation timed out. Terminating .
systemd[1]: httpd.service stop-final-sigterm timed out. Killing. -
The following can be found in
journalctl
:# journalctl -u httpd.service -u nginx.service -b
systemd[1]: Starting Startup script for nginx service...
systemd[1]: Starting The Apache HTTP Server...
.....
systemd[1]: httpd.service start operation timed out. Terminating.
systemd[1]: nginx.service start-pre operation timed out. Terminating.
Cause
Not sufficient timeout value for starting nginx or/and Apache.
Resolution
Note: This article may require additional administrative knowledge to apply. If any help is required, contact the server’s administrator or hosting support.
Add/increase TimeoutStartSec
value in the [Service]
section of Nginx or/and Apache init scripts:
-
Connect to the server using SSH.
-
Backup a required init script using the command like:
# cp -a /usr/lib/systemd/system/httpd.service{,.bak}
# cp -a /usr/lib/systemd/system/nginx.service{,.bak}
-
Open the init script with any text editor:
-
For Apache:
/usr/lib/systemd/system/httpd.service
-
For nginx:
/usr/lib/systemd/system/nginx.service
-
-
Increase value for
TimeoutStartSec
parameter:CONFIG_TEXT: [Service]
...
TimeoutStartSec=600
-
Connect to the server using SSH.
-
Backup a required init script using the command like:
# cp -a /usr/lib/systemd/system/apache2.service{,.bak}
# cp -a /usr/lib/systemd/system/nginx.service{,.bak}
-
Open the init script with any text editor:
-
For Apache:
/usr/lib/systemd/system/apache2.service
-
For nginx:
/usr/lib/systemd/system/nginx.service
-
-
Increase value for
TimeoutStartSec
parameter:CONFIG_TEXT: [Service]
...
TimeoutStartSec=600Note: In case the apache2.service file does not exist, the
TimeoutStartSec
value should be set in the/lib/systemd/system/apache2.service.d/apache2-systemd.conf
file
-
Connect to the server via SSH.
-
Backup the required init scripts with the commands:
# cp -a /lib/systemd/system/apache2.service{,.bak}
# cp -a /lib/systemd/system/nginx.service{,.bak}Note: The exact files can be found using:
# systemctl status apache2.service | grep loaded
# systemctl status nginx.service | grep loaded -
Open the init script with any text editor (for example vi):
For Apache:/lib/systemd/system/apache2.service
For nginx:/lib/systemd/system/nginx.service
-
Increase value for
TimeoutStartSec
parameter or set one if not set:CONFIG_TEXT: [Service]
...
TimeoutStartSec=600Note: In case the apache2.service file does not exist, the
TimeoutStartSec
value should be set in the/lib/systemd/system/apache2.service.d/apache2-systemd.conf
file
Comments
0 comments
Please sign in to leave a comment.