Apache Fails With "Syntax error on line #" on Server?

If you had an Apache/LiteSpeed-powered web server, you might see such an error that the HTTPD service is down by running the command line:

service httpd status -l

No luck, after you tried to start/restart the service. It didn't fix the problem by starting up the HTTPD service. Then you may try rebuilding the HTTPD configuration of the server by running the command line:

/scripts/rebuildhttpdconf

It also fails! Sometimes, because of the installed ModSec vendor, it triggers! On the situation, please check installed ModSec vendors:

whmapi1 modsec_get_vendors | grep -i vendor_id | uniq -u

As per our investigation, it happens mostly because of the Imunify360 ModSec vendor. If you see the Imunify360 ModSec vendor is installed on the server, try removing the ModSec vendor's ruleset entirely (If the Imunify360 ModSec vendor is not installed, try removing the other that is installed):

whmapi1 modsec_remove_vendor vendor_id=imunify360-full-apache

Once the ModSec vendor's ruleset is removed from the server, if you wish to reinstall it again, on the server, run the command:

whmapi1 modsec_add_vendor url=https://files.imunify360.com/static/modsec/v2/meta_imunify360-full-apache.yaml

For Apache: https://files.imunify360.com/static/modsec/v2/meta_imunify360-full-apache.yaml

For LiteSpeed: https://files.imunify360.com/static/modsec/v2/meta_imunify360-full-litespeed.yaml

After installing the ModSec vendor, make sure to enable it on the server:

whmapi1 modsec_enable_vendor vendor_id=imunify360-full-apache

Once it will be done, now, try rebuilding the HTTPD configuration and restarting the HTTPD service, also check its service status:

/scripts/rebuildhttpdconf && service httpd restart && service httpd status -l

The issue should be solved now! If you still have the issue, please contact us!

  • 4 Users Found This Useful
Was this answer helpful?

Related Articles

How to install LiteSpeed Web Server in cPanel?

Run the following command to install the LSWS plugin in cPanel: cd /usr/local/srcwget -N...

How to uninstall LiteSpeed on cPanel web server?

To uninstall LiteSpeed Web Server, perform the following steps: As the root user, convert your...

404 Not Found Error on All Websites (CyberPanel)

Make sure to check your website without HTTPS. If your website is accessible with HTTP and can't...

How can you Switch to Apache from LiteSpeed?

Apache and Litespeed are web servers. Both of them are good in their own ways and both of them do...

What to do if the activation of the LSWS license is failed?

If you've purchased a LiteSpeed license for your server from us, but you can't activate the...