The domain already exists in the Apache configuration : Causes and Fix
Billing automation tools like “WHMCS” help Web Hosts to create and edit accounts in a jiffy.
But things like high server load, database connection errors etc. can cause WHMCS to fail which results in partial creation or removal of domains.
And such partial entries on the server can cause domain recreation to fail with the error :
“The domain “abc.com” already exists in the Apache configuration.”
As part of our Dedicated Support Services, we often see this error when customers try to migrate domains, or change domain as main account etc.
Today let us discuss 3 scenarios where this error pops up and how we fix them.
What causes the error “The domain already exists in the apache configuration.”?
On new domain creation, cPanel first checks if the domain name is already present in any of the server configuration files.
And if a match is found, it aborts domain creation with the error “The domain already exists in the apache configuration.”
We’ll now see the common reasons for cPanel to show “Domain already exists” error.
1. Addon Domain Creation
Addon domain creation or deletion from cPanel works correctly in most cases.
But when there are server issues like bad disk, high load etc., domain deletion process can get stuck half-way. And then, addon domain entries are not properly removed from the server files.
When a customer tries to add the same domain again, it will result in the error shown in the image below:
But the domain never shows up under Addon Domains in cPanel.
The same error can happen even with domain migration or backup-restore as well.
2. Add new domain that matches server hostname
By default, cPanel adds an entry for server name in the Apache configuration file.
Some VPS server owners set the server name as their domain name itself. In such servers, when customers try to create a domain that matches server name, it shows the error “Domain already exists in the Apache configuration”.
It is important to ensure that server name is set as something like server.xyz.com and not xyz.com. Then there will not be any issues while creating new domain xyz.com.
3. WHMCS Module Command error
WHMCS can malfunction when there are connectivity issues with server and this causes tasks to fail.
Due to such issues, if a webhosting provider re-submits the ‘create account’ button, it results in the error :
Module Command Error: The domain “xyz.com” already exists in the Apache configuration.
How to fix “Domain already exists in the apache configuration”
Although there are many situations where this error pops up, the fix is to correct the duplicate entries for the domain.
Our Hosting Support Engineers check the server and remove entries for conflicting domain in Apache configuration file, httpd.conf. Then we rebuild Apache on the server.
But we’ve seen situations where error still exists due to domain entries present in cPanel user data files.
In such cases, we remove the user related files from /var/cpanel/userdata/ and clear user related cache. That fixes the error and domain creation works fine.
The presence of duplicate records for the domain in the Web server files results in account creation errors. We’ve discussed couple of scenario where server complains “Domain already exists” and how our Dedicated Support Engineers fix them.