Enabling Wildcard DNS on CPanel Servers

How to do it?
1. Login to WHM
2. Click on Edit DNS Zone on the side navigation.
3. Choose the domain to edit, and click on the Edit button.
4. Under Add New Entries Below this Line add this:
Domain: *
TTL: 14400 (this is the default value)
Record Type: A in (your IP address)
5. Submit and this will now be added.
6. Access your httpd.conf file. Login as root, via SSH.
7. To access the file in a CPanel server go to:
# cd /etc/httpd/conf/
8. Use your favorite text editor, or just simply type:
# pico httpd.conf
9. Do a find on your domain and you may find something like this:
<VirtualHost ip.ip.ip.ip>
ServerAlias yourdomainserver.com
ServerAdmin webmaster@yourdomainserver.com
DocumentRoot /home/yourdoma/public_html
BytesLog domlogs/yourdomainserver.com-bytes_log
ServerName www.yourdomainserver.com
User yourdoma
Group yourdoma
CustomLog /usr/local/apache/domlogs/yourdomainserver.com combined
ScriptAlias /cgi-bin/ /home/yourdoma/public_html/cgi-bin/
</VirtualHost>
On the line:
ServerAlias yourdomainserver.com
Change to:
ServerAlias: *.yourdomainserver.com yourdomainserver.com
10. Exit or press Ctrl X if using Pico.
11. Save the file when asked and replace the existing file.
12. Restart the apache web server by typing in:
# service httpd restart
Done! You are all set to go. Wildcard DNS Enabled on a CPanel Server

Leave a Comment