CPanel Wildcard Sub-domains

Thought I might post this as I found it really useful, and its info not easily found online..
The following is how to add a wildcard DNS entry for any domain on a WHM/CPanel server.

======================

edit the dns zone to add * in A with IP address
make or edit the directories for your domain (not the public_http dir, this has to be in the root server files)
for non-ssl http make a directory here..
/usr/local/apache/conf/userdata/std/2/username/domain.com
and for ssl https make a directory here..
/usr/local/apache/conf/userdata/ssl/2/username/domain.com
And then in those directories add a file:
some_file_name.conf
which contains the configuration options you want added to that specific VirtualHost.
For example if you want to add a wildcard ServerAlias, you would just create this file and add:
ServerAlias *.domain.com
The key for the filename is that it has to be a .conf extension so that it is picked up.
Once you make the first change to the VirtualHost, from ssh prompt as root run:
/scripts/ensure_vhost_includes –user=username
======================