Symptoms
You receive an error similar to the following when rebuilding the Apache configuration, and the hostname in the error doesn't match the server's hostname.
Bad configuration file located at /etc/apache2/conf/httpd.conf.work.4cd5684f
Error:
The “/usr/sbin/httpd -DSSL -t -f /etc/apache2/conf/httpd.conf.work.4cd5684f.cfgcheck -C Include "/etc/apache2/conf.modules.d/*.conf"” command (process 1383) reported error number 1 when it ended.
Configuration problem detected on line 219 of file /etc/apache2/conf/httpd.conf.work.4cd5684f: RemoteIP: Error parsing IP server.domain.tld (Name or service not known error) for RemoteIPInternalProxy
--- /etc/apache2/conf/httpd.conf.work.4cd5684f ---
213# This allows us to not log requests proxied to Apache from nginx;
214# That way hits are not double recorded.
215SetEnvIf cPanel-localhost DBTbOahLsCHIWgxm7vhO8w3rNNgUmWafg22hUHD83xkbL3-wiIwu7Cu9Kvxm5FTT isproxyrequest
216RequestHeader unset cPanel-localhost
217<IfModule remoteip_module>
218 RemoteIPHeader X-Forwarded-For-DBTbOahLsCHIWgxm7vhO8w3rNNgUmWafg22hUHD83xkbL3-wiIwu7Cu9Kvxm5FTT
219 ===> RemoteIPInternalProxy server.localhost.com <===
220 RequestHeader unset X-Forwarded-For-DBTbOahLsCHIWgxm7vhO8w3rNNgUmWafg22hUHD83xkbL3-wiIwu7Cu9Kvxm5FTT
221</IfModule>
222
223<IfModule mod_log_config.c>
224 LogFormat "%v:%p %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combinedvhost
225 <IfModule logio_module>
--- /etc/apache2/conf/httpd.conf.work.4cd5684f ---
[root@server ~]cPs# hostname
new.domain.tld
[root@server ~]cPs#
Description
This issue occurs when the server's hostname is partially changed. Resetting the hostname will correct the issue.
Workaround
- Access the server's command line as the 'root' user via SSH or "Terminal" in WHM.
- Run the following command to sync the new hostname across the server's configurations.
/usr/local/cpanel/bin/set_hostname $new.domain.tld
- Rebuild the Apache configuration.
/usr/local/cpanel/scripts/rebuildhttpdconf
- Restart the web server.
/usr/local/cpanel/scripts/restartsrv_httpd
Additional resources
What is an effective hostname?
Comments
0 comments
Article is closed for comments.