Reseting config files and hosts to defaults?

eminos

Member
Oct 26, 2011
21
1
51
cPanel Access Level
Root Administrator
Hi,

I'm a fairly new cPanel administrator, and I think a messed up with the config files a little bit.

When I installed cPanel and got to know it a little bit I customized some template file (I can't even find my modification anymore) to add a host as a ServerAlias in the Apache config file.
I wanted to use a preview URL in this format: customerdomain.tld.preview.webhost.com.
And actually it worked and still works fine (somehow), but my customization made some extra domains/hosts show up in cPanel. For example in the Simple DNS Zone Editor, a part from the regular domain.tld I have domain.tld.preview.webhost.com. I don't want that.

I want to get rid of all of this and just use the build in www.webhost.com/~customer format for preview URLs. For now.

I tried EasyApache and the Reset Apache Config to default setting at the end, but it didn't seem to solve my problem.

How could I reset to default and rebuild all the config files, but not lose my domains and hosts of course.

Grateful for help.
Thanks.

/E
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
Hello,

Did you happen to edit a file in /var/cpanel/userdata/ location? These files will be used for building Apache, so if you edited anything there, it will continue to show up in Apache whenever it is rebuilt.

Code:
cd /var/cpanel/userdata
grep customerdomain.tld.preview.webhost.com ./*
If this isn't where you added it, it might have been by creating a vhost.local file in /var/cpanel/templates/apache2 location. You could simply move vhost.local to /root and then cPanel will begin using vhost.default instead of that custom file.

After you've located whether it was a userdata file or a custom vhost.local file, please note you should then rebuild Apache again and restart it:

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

eminos

Member
Oct 26, 2011
21
1
51
cPanel Access Level
Root Administrator
Actually what I just noticed is that whatever I did with the template file I edited, it somehow created Parked Domains for all the users/domains. Now I'm just "UnParking" them via WHM and all seems good. The new httpd.conf is regenerated just fine (without the extra ServerAlias).

I guess the template file that I edited is now reset to default. Don't know if that happened with a cPanel automatic update, or something else.

I still have a lot to learn about cPanel/WHM! :)