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: example.com
- additional domain: example.org
Add example.org to the george account
- Login to WHM as a reseller with the all ACL
- Click Add a DNS Zone
- Populate the IP field with the proper IPv4 Address
- Input example.org in the Domain field
- Click george in the Users list
- Click Add Zone
The above steps configure the server to respond to DNS requests for example.org. Also the george account is setup to own the domain.
Create the necessary userdata
- Login to the server via SSH with root-level access
Go to the userdata directory for george:
Create a file named example.org with the following contents (formatting is very important):
--- documentroot: /home/george/example.org group: george hascgi: 0 homedir: /home/george ip: 184.108.40.206 ipv6: ~ no_cache_update: 0 owner: root phpopenbasedirprotect: 1 serveradmin: email@example.com serveralias: example.org www.example.org servername: example.org 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:
--- addon_domains: example.org: example.org main_domain: example.com parked_domains:  sub_domains: - aezula.com
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 example.com” to locate the proper VirtualHost. Any mistakes should be fixed by doing the following:
- modify /var/cpanel/userdata/george/example.org
- Rebuild the Apache configuration: /scripts/rebuildhttpdconf
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:://example.org 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.