// In each of the following steps, be sure replace [domain.com] with your alias domain (eg. mydomain.com) and [parentdomain] with the domain to be aliased (eg. mydomain.net). Be sure to remove the square brackets, of course.
// In each of the following steps, be sure replace ###.###.###.### with your IP address for the parent domain.
// In each of the following steps, be sure replace [NS1.NAMESERVER.NET] with your Primary Nameserver and [NS2.NAMESERVER.NET] with your Secondary Nameserver. Be sure to remove the square brackets, of course.
// Note: I use Plesk 7 Reloaded with authoritative Nameservers.
1. login via SSH and #cd /etc/httpd/conf/
2. create or modify the file "httpd.domainalias.conf" (you will have to create this file for the first alias, but just modify it for subsequent ones) by adding code like the following:
CODE
<VirtualHost ###.###.###.###:80>
ServerName [domain.com]
ServerAlias *.[domain.com]
DocumentRoot /home/httpd/vhosts/[parentdomain.com]/httpdocs
<Directory /home/httpd/vhosts/[parentdomain.com]/httpdocs>
AddType application/x-httpd-php .php .php4 .php3 .phtml
php_admin_flag engine on
</Directory>
</VirtualHost>
ServerName [domain.com]
ServerAlias *.[domain.com]
DocumentRoot /home/httpd/vhosts/[parentdomain.com]/httpdocs
<Directory /home/httpd/vhosts/[parentdomain.com]/httpdocs>
AddType application/x-httpd-php .php .php4 .php3 .phtml
php_admin_flag engine on
</Directory>
</VirtualHost>
(Optional) If you want to alias HTTPS requests, also add code like this:
CODE
<VirtualHost ###.###.###.###:443>
ServerName [domain.com]
ServerAlias *.[domain.com]
DocumentRoot /home/httpd/vhosts/[parentdomain.com]/httpsdocs
<Directory /home/httpd/vhosts/[parentdomain.com]/httpsdocs>
AddType application/x-httpd-php .php .php4 .php3 .phtml
php_admin_flag engine on
</Directory>
</VirtualHost>
ServerName [domain.com]
ServerAlias *.[domain.com]
DocumentRoot /home/httpd/vhosts/[parentdomain.com]/httpsdocs
<Directory /home/httpd/vhosts/[parentdomain.com]/httpsdocs>
AddType application/x-httpd-php .php .php4 .php3 .phtml
php_admin_flag engine on
</Directory>
</VirtualHost>
3. When you first create the file "http.domainalias.conf" you must put an include line in the "http.conf" file like this:
CODE
Include /etc/httpd/conf/httpd.domainalias.conf
I put mine at the bottom of the file, but just above this line:
CODE
Include /etc/httpd/conf/httpd.include
4. go to /var/named/run-root/etc/
5. modify the file "named.conf" by adding the following code:
CODE
zone "[domain.com]" {
type master;
file "[domain.com]";
};
type master;
file "[domain.com]";
};
6. go to /var/named/run-root/var/
7. add a file called "[domain.com]" which contains the following code:
CODE
$TTL 86400
@ IN SOA [NS1.NAMESERVER.NET]. admin.localhost.localdomain. (
1016902773; Serial
10800; Refresh
3600; Retry
604800; Expire
86400 ); Minimum
[domain.com]. IN NS [NS1.NAMESERVER.NET].
[domain.com]. IN NS [NS2.NAMESERVER.NET].
[domain.com]. IN A ###.###.###.###
www.[domain.com]. IN CNAME [domain.com].
ftp.[domain.com]. IN CNAME [domain.com].
[domain.com]. IN MX 10 mail.[domain.com].
mail.[domain.com]. IN A ###.###.###.###
webmail.[domain.com]. IN A ###.###.###.###
*.[domain.com]. IN A ###.###.###.###
@ IN SOA [NS1.NAMESERVER.NET]. admin.localhost.localdomain. (
1016902773; Serial
10800; Refresh
3600; Retry
604800; Expire
86400 ); Minimum
[domain.com]. IN NS [NS1.NAMESERVER.NET].
[domain.com]. IN NS [NS2.NAMESERVER.NET].
[domain.com]. IN A ###.###.###.###
www.[domain.com]. IN CNAME [domain.com].
ftp.[domain.com]. IN CNAME [domain.com].
[domain.com]. IN MX 10 mail.[domain.com].
mail.[domain.com]. IN A ###.###.###.###
webmail.[domain.com]. IN A ###.###.###.###
*.[domain.com]. IN A ###.###.###.###
// Steps 8 through 10 are for Mail...
8. go to /var/qmail/control/
9. modify "rcpthosts" by adding the following code:
CODE
[domain.com]
10. modify "virtualdomains" by adding the following code:
CODE
[domain.com]:[virtual#id]
where "virtual#id" corresponds to the integer of the virtual domain that this domain is aliasing (this id is already specified in the same file).
11. Restart your services:
#service named restart
#service httpd restart
#service qmail restart
12. Repeat this process for however many Domain Aliases you want to create.
// Note: This process does NOT rack up domains against your Plesk licence, and making changes to the parent domain in Plesk will NOT adversely affect any of the above steps. Enjoy!