Creating Proper Addon Domains in cPanel & WHM

30 Sep 2013

This HOWTO describes the creation of additional domains for cPanel Accounts, without using the Addon Domain feature. The end result is an domain owned by the account, without the over head of an unwanted FTP account, nor an unwanted sub domain.

Before doing any of the below, please know that this is an unsupported, manual change to the account data used by cPanel & WHM. These steps were tested against cPanel & WHM version 11.40. There is no guarantee these steps will work with future versions of the product. If cPanel decides to add similar support, there is no guarantee that your manual changes will be grandfathered in. Domains added in this manner will not properly appear in the cPanel & WHM interfaces.

Note: these steps require root-level access to the server.

For illustration, we use the following fictitious setup:

  • account name: george
  • primary domain:
  • additional domain:

Add to the george account

  1. Login to WHM as a reseller with the all ACL
  2. Click Add a DNS Zone
  3. Populate the IP field with the proper IPv4 Address
  4. Input in the Domain field
  5. Click george in the Users list
  6. Click Add Zone

The above steps configure the server to respond to DNS requests for Also the george account is setup to own the domain.

Create the necessary userdata

  1. Login to the server via SSH with root-level access
  2. Go to the userdata directory for george:

     cd /var/cpanel/userdata/george
  3. Create a file named with the following contents (formatting is very important):

     documentroot: /home/george/
     group: george
     hascgi: 0
     homedir: /home/george
     ipv6: ~
     no_cache_update: 0
     owner: root
     phpopenbasedirprotect: 1
     usecanonicalname: 'Off'
     user: george
     userdirprotect: ''

Here is a description of some of the important entries;

  • documentroot: this is the directory, within the cPanel account’s home directory, that will contain the website content.
  • group: the operating system group name of the cPanel account.
  • homedir_: the path to the cPanel account’s home directory
  • ip: the IPv4 address you used in step 1.3
  • owner: the reseller that owns the cPanel account
  • erveradmin: the contact email address used by Apache when generating error messages
  • serveralias: here is where you input the domain name you added in step 1. You should also include the www sub domain variant of the domain name.
  • servername: the primary name Apache uses for this entry.
  • user: the name of the cPanel account

Add the domain to the account’s userdata

Modify /var/cpanel/userdata/george/main to resemble the following:

	parked_domains: []

Create the proper entries in Apache’s httpd.conf

Run the following command /scripts/rebuildhttpdconf. You should now have a proper VirtualHost entry in /usr/local/apache/conf/httpd.conf.

To verify the entry, open /usr/local/apache/conf/httpd.conf using your favorite editor or file viewer. Look for “ServerName” to locate the proper VirtualHost. Any mistakes should be fixed by doing the following:

  1. modify /var/cpanel/userdata/george/
  2. Rebuild the Apache configuration: /scripts/rebuildhttpdconf

Restart Apache

Use the following command: /scripts/restartsrv_apache

Open the domain with your browser

If all went well, you should now be able to load http::// in your browser. You may want to place a holding, or test, page in the domain document root to verify the proper site is loading.

comments powered by Disqus