nwh

Registered
Nov 21, 2011
2
0
51
cPanel Access Level
Root Administrator
Hello,

I am getting: Sorry, that domain is already setup (remove it from httpd.conf). This account has been already removed from the server, but virtual host exists. How to safely remove virtual host for this domain, since you don't recommend direct editing of httpd.conf?

Thanks for your reply!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,226
463
Hello :)

Terminating the account should have removed any VirtualHost entries for the domain names added to that account. You may want to check if the same domain name is added to another account. The following commands should be useful for this:

Code:
/scripts/whoowns domain.com
Code:
grep domain.com /var/cpanel/users/*
You can also view the VirtualHost entry in the httpd.conf file to see which username it's associated with.

Thank you.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
If the domain doesn't end up existing in /var/cpanel/users/* location with any user, you may well need to go to /var/cpanel/userdata and do a grep for it:

Code:
cd /var/cpanel/userdata
grep -R domain.com ./*
After you find out what file or files that domain is in, you should remove the domain from that file after creating a backup of the file. Also, if a domain.com file exists for that domain, move that file elsewhere such as to /root

After any files have been modified to no longer include the domain, then copy httpd.conf, rebuild it and restart it and try again to add the domain:

Code:
cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.111122
/scripts/rebuildhttpdconf
/etc/init.d/httpd restart