Symptoms
Switch from LiteSpeed to Apache fails with the below errors:
Detected Plesk Environment
...
Warning: The unit file, source configuration file or drop-ins of httpd.service changed on disk. Run 'systemctl daemon-reload' to reload units.
[ERROR] Apache is not up within 30 secs. Please check the log file.
Cause
Corrupted Apache service configuration file.
Resolution
For RPM-based distributions (CentOS, RedHat, Cloudlinux, etc):
-
Connect to the server via SSH.
-
Create the file
/usr/lib/systemd/system/httpd.service
with the following content:# cat /usr/lib/systemd/system/httpd.service
[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target
Documentation=man:httpd(8)
Documentation=man:apachectl(8)[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/httpd
ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND
ExecReload=/usr/sbin/httpd $OPTIONS -k graceful
ExecStop=/bin/kill -WINCH ${MAINPID}
# We want systemd to give httpd some time to finish gracefully, but still want
# it to kill httpd after TimeoutStopSec if something went wrong during the
# graceful stop. Normally, Systemd sends SIGTERM signal right after the
# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give
# httpd time to finish.
KillSignal=SIGCONT
PrivateTmp=true[Install]
WantedBy=multi-user.target -
Unmask the
httpd
service:# systemctl unmask httpd
-
Re-enable it so the required symlinks are created automatically:
# systemctl disable httpd
# systemctl enable httpd -
Start Apache:
# systemctl start httpd
For DEB-based distributions (Debian, Ubuntu):
-
Connect to the server via SSH.
-
Create the file
/lib/systemd/system/apache2.service
with the following content:# cat /lib/systemd/system/apache2.service
[Unit]
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target[Service]
Type=forking
Environment=APACHE_STARTED_BY_SYSTEMD=true
ExecStart=/usr/sbin/apachectl start
ExecStop=/usr/sbin/apachectl stop
ExecReload=/usr/sbin/apachectl graceful
PrivateTmp=true
Restart=on-abort[Install]
WantedBy=multi-user.target -
Unmask the
apache2
service:# systemctl unmask apache2
-
Re-enabled it so the required symlinks are created automatically:
# systemctl disable apache2
# systemctl enable apache2 -
Start Apache:
# systemctl start apache2