When trying to rebuild the Apache configuration file, the system will fail and return this:
httpd: Syntax error in -C/-c directive: Include/IncludeOptional: Could not open directory /usr/local/apache/conf.modules.d: No such file or directory
In some scenarios, Apache will not be able to rebuild the configuration file. This can also cause the Apache service to not start. If you attempt to rebuild the Apache configuration file, and it fails because with the output below, we are going to need to reinstall the Apache Config Runtime package.
Initial configuration generation failed with the following message:
The “/usr/local/apache/bin/httpd -DSSL -t -f /usr/local/apache/conf/httpd.conf.work.0804ff6d.cfgcheck -C Include "/usr/
local/apache/conf.modules.d/*.conf"” command (process 1063594) reported error number 1 when it ended.
httpd: Syntax error in -C/-c directive: Include/IncludeOptional: Could not open directory /usr/local/apache/
conf.modules.d: No such file or directory
The solution for this would be to reinstall the Apache Config Runtime package. To do this, please run the following commands:
# rpm -e --nodeps --justdb ea-apache24-config-runtime.noarch
# yum install ea-apache24-config-runtime.noarch
Once the packages are installed, attempt to rebuild and restart Apache using the command below:
# /scripts/rebuildhttpdconf && /scripts/restartsrv_apache