Symptoms
Apache will not start after installing Nginx, and you will see a message similar to the following in the Apache error log.
restartsrv_httpd[13218]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:443
You will see output similar to the following when you attempt to rebuild the Apache configuration.
The “/usr/sbin/httpd -DSSL -t -f /etc/apache2/conf/httpd.conf.work.711552bd.cfgcheck -C Include "/etc/apache2/conf.modules.d/*.conf"” command (process 166038) reported error number 1 when it ended.
Configuration problem detected on line 220 of file /etc/apache2/conf/httpd.conf.work.711552bd: RemoteIP: Error parsing IP vm.server.tld (Name or service not known error) for RemoteIPInternalProxy
Description
The issue occurs when the server's hostname becomes unsynchronized in its configuration files. Resetting the server's hostname will allow the Apache configuration to be rebuilt so that Apache can start.
Workaround
- Access the server's command line as the 'root' user via SSH or "Terminal" in WHM.
- Run the following command to set the server's hostname.
whmapi1 sethostname hostname=$hostname.domain.tld
Please note that "$hostname.domain.tld" needs to be replaced with the new hostname. - Rebuild the Apache configuration.
/usr/local/cpanel/scripts/rebuildhttpdconf
- Restart Apache.
/usr/local/cpanel/scripts/restartsrv_httpd
Additional resources
How to modify a server's hostname from the command line
How to rebuild the Apache configuration