This tutorial describes how to setup a wildcard DNS record in Plesk 8 using Bind and Apache. This allows you to use *.domain.com to access your www.domain.com (http://www.domain.com) website. For example, any of the following would be automatically redirected to www.domain.com (http://www.domain.com)
test.domain.com
john.domain.com
jane.domain.com
bugs.domain.com
Let’s get started!
1. Configure Plesk/Bind DNS
Add a wildcard CNAME record to DNS in Plesk by going to DOMAINS>click the domain you want to configure here>DNS. Add a new record
Record type: CNAME
Enter domain name: *.domain.com
Enter a canonical name: domain.com
So you should have a new record that looks something like this
*.domain.com. CNAME domain.com.
2. Configure Apache
SSH to your server and edit the vhost.conf file (you may have to create it if you don’t have one for your domain).
# cd /var/www/vhosts/domain.com/conf
# touch vhost.conf
# vi vhost.conf
Add this line to the file
ServerAlias *.domain.com
Save and close the vhost.conf file
Now you must reconfigure the domain via Plesk to pick up the new vhost.conf changes (adds a line to the httpd.include file to look at the directives in the vhost.conf). You can’t edit the httpd.include file directly as it’s overwritten by Plesk all the time. You must make your custom changes to the vhost.conf file.
# /usr/local/psa/admin/sbin/websrvmng –reconfigure-vhost –vhost-name=domain.com
Restart the httpd service and thats it.
# /sbin/service httpd restart