Symptoms
-
Apache fails to restart with one of the following errors, depending on where the configuration is damaged:
CONFIG_TEXT: httpd: Syntax error on line ## of /etc/apache2/conf/httpd.conf: Expected </VirtualHost> but saw </VirtualHost>>
CONFIG_TEXT: httpd: Syntax error on line ## of /etc/apache2/conf/httpd.conf: <IfModule> directive requires additional arguments
CONFIG_TEXT: httpd: Syntax error on line ## of /etc/apache2/conf/httpd.conf: </VirtualHost>conf.d/userdata/std/2_4/USER/domain.tld/*.conf"> directive missing closing '>'
CONFIG_TEXT: httpd: Syntax error on line ## of /etc/apache2/conf/httpd.conf: </IfModule> without matching <IfModule> section
CONFIG_TEXT: httpd: Syntax error on line ## of /etc/apache2/conf/httpd.conf: </VirtualHost> without matching <VirtualHost> section
CONFIG_TEXT: httpd: Syntax error on line ## of /etc/apache2/conf/httpd.conf: <VirtualHost IP:PORT> was not closed.
- An existing domain is missing from the Apache configuration, or a newly created domain was not written to it, while Apache otherwise keeps running.
- The issue can begin after AutoSSL renews or installs a certificate.
Cause
These syntax errors are due to portions of the Apache configuration not being written during generation and are only seen after AutoSSL installs a certificate. The result can also be an existing domain missing from the configuration, or a new domain not written to it.
We've opened an internal case for our development team to investigate this further. For reference, the case number is CPANEL-57955. Follow this article to receive an email notification when a solution is published in the product.
Related cases: CPANEL-40396 (open), CPANEL-40348 (closed, related symptom: vhost missing from httpd.conf), CPANEL-34877, CPANEL-34842.
Unconfirmed hypothesis from one customer's analysis: the httpd.conf.datastore file is judged fresh by comparing whole-second mtimes, so after httpd.conf is rewritten in the same second as the datastore, the datastore keeps stale byte offsets. The SSL install then edits a vhost at the wrong position, and the SSL install path does not run a syntax check before the restart. In a lab, inserting a line before the first vhost, equalizing the mtimes with touch -r, and installing a certificate with whmapi1 installssl produced a file with 12 opening and 10 closing VirtualHost tags and a syntax error. The natural trigger is not reproduced.
Resolution
- Log into the server via SSH.
-
Rebuild the Apache configuration and restart Apache:
# /scripts/rebuildhttpdconf; /scripts/restartsrv_httpd
Comments
0 comments
Article is closed for comments.