Setting ServerAlias for a cPanel account

Mozai

Member
Oct 21, 2014
12
0
1
cPanel Access Level
Root Administrator
I'm trying to add a serveralias for a cPanel account, but cPanel won't let me. I understand it wants to stop me from shooting myself in the foot, but just because I've pointed the gun down doesn't mean my foot is always under it.

I have an account on a machine where I have both WHM and cPanel access. The account's website has two hostnames I'll call "alpha1.com" and "alpha2.com" for the same website. I wish to add another hostname "alphaone.com" because we'll soon acquire that domain name and I wish for the transition to be seamless when DNS is updated.

If I wasn't using cPanel/WHM, I'd just edit /etc/apache/*.conf, add or update a 'ServerAlias' line and be done.

In cPanel for the account, I go to Domains >> Parked Domains, try to add "alphaone.com" and cPanel refuses because that hostname doesn't currently point to this host. I already know this, and I'm okay with this, but cPanel doesn't give me the option of going ahead.

I've tried editing /var/cpanel/users/$accountname to add another "XDNS?=" line, then run
/usr/local/cpanel/scripts/updateuserdomains , but /var/cpanel/userdata/$accountname/* doesn't mention the new XDNS3 entry... so the next time cpanel refreshes the apache configuration, the extra serveralias will not appear (or will get erased if someone edited /usr/local/apache/conf/httpd.conf by hand).

How do I get WHM/cPanel to add another hostname to the ServerAlias config setting for an apache vhost, without erasing it later, and despite the fact that the hostname doesn't currently point to this server's IP address(es) ?
 

Infopro

Well-Known Member
May 20, 2003
17,090
519
613
Pennsylvania
cPanel Access Level
Root Administrator
Twitter
This may be of some use:

WHM » Server Configuration » Tweak Settings, Domains tab, enable this, add your domain, and then disable afterward.

Allow Remote Domains
Allow creation of parked/addon domains that resolve to other servers (e.g. domain transfers) This can be a major security problem. If you must have it enabled, be sure not to allow users to park common Internet domains.
 
  • Like
Reactions: Mozai