Complete Solution to Domain already exists error in Apache Configuration

Category : cPanel/WHM

This error occurs when subdomains, domain parks, and addon domains are created using cPanel. Usually because of the domain name *somewhere* in a server area or the fact that old traces are present.

How to fix this error?

The issue can be fixed by deleting its DNS through WHM, which is on the “Delete DNS zone” or by executing commands via SSH/scripts / killdnsyourdomain.com. However, if this step is already done and the error still exists, what you have to do is check and clean in SSH to remove the information domain name you want to delete.

Addon Domain Error

 

Check out mentioned locations/steps to find the domain that is lurking somewhere and causing the issues.

 Reason 1: Pre-existing zone file on the server.

1) Use the following command to check whether zone exists or not,

dig @server_ip domain.com

If a zone file exists, this will show the record of the domain.com.

2) If a zone file exists, log into the server that the zone file is pointing to and make sure the domain doesn’t exist:

/scripts/whoowns domain.com

If it does, you would need to remove this prior to adding their new addon domain. If it does not, continue

3) Remove the zone file from master by running the following command:

/scripts/killdns domain.com

This will then get rid of the pesky zone file that is getting in the way of their addon creation.

Reason 2: Old traces of the domain remain on the server

1) Log into the server where the customer is seeing problems adding the domain and confirm that the domain does not exist on the server.

/scripts/whoowns domain.com

2) Check cPanel files for traces of the problem domain name

# grep domain.com /var/cpanel/users/*

grep -R domain.com /var/cpanel/userdata/*

3) Edit any files that are found and remove the traces of the domain name the customer is trying to add. You can remove the lines that contain the mentioned domain. You may also need to remove the entire file for the domain in the /var/cpanel/userdata/USERNAME/ directory.

4) Rebuild the user domains database

/scripts/updateuserdomains

5) Rebuild the Apache configuration and make sure apache is running with all traces of the bad domain removed.

# /scripts/rebuildhttpdconf ; service httpd restart

This should have all traces that were left behind from when this domain name was removed in the past and then will no longer cause a conflict while adding the domain again.

You should now be able to add the domain, if unsuccessful please submit a support ticket and we will gladly assist in helping you.