cPanel addon domain creation: ‘The domain already exists in the Apache configuration.’

Scenario:

We might get an error when adding an addon or parked domain via cPanel. The domain name never shows up under Addon Domains in cPanel but it does exists anywhere in the cPanel configuration. Lets’s see how to remove any trace of the domain from cPanel configuration manually.

mydomain

First you need to check if the domain is owned by any particular user.

/scripts/whoowns mydomain.com owner 

OR

#grep mydomain.com /etc/userdomains

mydomain.com: owner

Now you need to check if the zone file for the domain exists.

# ls -ld /var/named/mydomain.com.db

-rw------- 1 named named 1198 Sep 4 2013 /var/named/mydomain.com.db

There exists a zone file for the domain and can remove the zone by executing the below command:

# /scripts/killdns mydomain.com

 Now we need to check cPanel user files to see if there exists any traces of the domain.

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

/var/cpanel/users/owner:DNS4=mydomain.com
# grep -R mydomain.com /var/cpanel/userdata/*

Binary file /var/cpanel/userdata/owner/main.cache matches

/var/cpanel/userdata/owner/main /var/cpanel/userdata/owner/main: mydomain.com: mydomain.testdomain.com

/var/cpanel/userdata/owner/cache: mydomain.com: mydomain.testdomain.com

Edit any files that are found and remove the entire line that contains the domain name. Once you’ve done this, there shouldn’t be any entry for mydomain.com in the cPanel configuration file.

Rebuild the User domain database:

/scripts/updateuserdomains

Rebuild the Apache configuration

/scripts/rebuildhttpdconf

You’d need to restart the Web Server as the configuration file is altered.

If the server is running on apache

# service httpd restart

If the server is running on LiteSpeed:

# service lsws restart

 

Once you’ve done all the steps, you should be able to add mydomain.com as an Addon domain under the account ‘owner’

  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

How to create a cPanel user account?

To create a new cPanel account go to WHM >> Account Functions >> Create a New...

How can I limit the number of emails a domain can send out per hour?

Click on the "Tweak Settings" link under "Server Setup". Within the "Mail" section is a text box...

How can I limit access to certain directories on my server by requiring a password using cPanel/WHM?

In cPanel, it is very simple to limit access to a directory on your server. This can be used to...

How do I prevent SSL Certificate Warnings when accessing cPanel?

All cPanel servers come with self-signed certificates configured to secure the control panel as a...

How do I create a MySQL database and user in cPanel/WHM? How do I connect them?

To create a MySQL database and user, log into the cPanel interface for the desired domain and...

Powered by WHMCompleteSolution