Help - Search - Members - Calendar
Full Version: HOWTO Setup a Domain Alias on Plesk
The Planet Forums > Control Panels > Plesk > Plesk HOWTOs
Auroborus
As far as I'm concerned, Plesk is by far the best and most advanced Control Panel out there. However, it has always been lacking one essential feature: the ability to easily create domain aliases. Due to this severe shortcoming, I sometimes use Ensim instead. But reliable as it is, Ensim is not nearly as feature-rich and user-friendly as Plesk. So, I have struggled for some time to come up with the a way to create domain aliases, and find have a solution that I've tested thoroughly to meet my expectations of a domain alias, which includes HTTP, HTTPS, FTP and also Mail.

// 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>

(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>

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]";

};

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 ###.###.###.###

// 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!
dv8yourplanet
Just wondering if you knew how to add domain aliases via FreeBSD? I am completely lost in the unix world :eek:
londo
did anybody put this into a script yet?

I tried the one that comes with 'power tools' but apparently it has issuses with my 7.5.2 install
villaje
Has anybody tried this and got it to wor?

[domain.com] with your alias domain (eg. mydomain.com) and [parentdomain] with the domain to be aliased

so domain.com is the original name setup in Plesk or is it parentdomain? Didn't quite get that.
Thanks,
JLChafardet
QUOTE (villaje)
Has anybody tried this and got it to wor?

[domain.com] with your alias domain (eg. mydomain.com) and [parentdomain] with the domain to be aliased

so domain.com is the original name setup in Plesk or is it parentdomain? Didn't quite get that.
Thanks,


parentdomain is the domain that is setup in Plesk, [domain.com] is the domain to alias.

regards,
incogni
QUOTE (Auroborus)
$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 ###.###.###.###


Which Serial i should enter? The one from the Parentdomain or can i take a phantasy-number? Have enter this in another config file?

Is it possible to enter here the "plesk"-nameserver from the parentdomain?
CODE
[domain.com].    IN NS [NS1.parentdomain.NET].

[domain.com].    IN NS [NS2.parentdomain.NET].

Thank you
inc.
Auroborus
QUOTE
Which Serial i should enter?

Just copy this entire section from your [parentdomain.com] file:

CODE
@ IN SOA [NS1.NAMESERVER.NET]. admin.localhost.localdomain. (

1016902773; Serial

10800; Refresh

3600; Retry

604800; Expire

86400 ); Minimum


QUOTE
Is it possible to enter here the "plesk"-nameserver from the parentdomain?

You must use legitimate Nameservers. Presumably these should be the same as your [parentdomain.com], so again, just copy the Nameservers from your [parentdomain.com] file.


incogni
Worked fine :-)

inc.
miketyson
Hi! Great solution, thankyou.

I'm just wondering, how does this work with subdomains? If I have subd.[parentdomain.com], how does one make that work with subd.[domain.com]? Does one have to add subd.[domain.com] to /var/named/run-root/var/[domain.com]?

It would be nice for users to be able to add subdomains through Plesk's control panel and have those subdomains work with their domain aliases too...

Cheers =)

Mike
eandhra
Great Info ..
Few Questions:
is this process is good for latest version pleask7.5 ?
I have hundreds of domains and I like to add all of them as alias in one shot, how ?
i guess, plesk has limitations on number of domains, is adding domain as alias counts ?
i like to add domains as alias just to forward to main domain name, so I don;t need any of the server features like mail etc etc .. so .. what's the simplest way adding domains as alias ?

I really appreciate the answers, It will help me a lot ..
eandhra
just found this link -- http://faq.sw-soft.com/article_41_894_en.html
very simple steps ..
Auroborus
QUOTE (eandhra)
is this process is good for latest version pleask7.5?
Yes

QUOTE (eandhra)
I have hundreds of domains and I like to add all of them as alias in one shot, how?

Unless someone has turned this into a script, this remains the easiest way.

QUOTE (eandhra)
i guess, plesk has limitations on number of domains, is adding domain as alias counts?

The bottom of my thread notes "This process does NOT rack up domains against your Plesk licence".

QUOTE (eandhra)
i like to add domains as alias just to forward to main domain name, so I don;t need any of the server features like mail etc etc .. so .. what's the simplest way adding domains as alias?
The second half of Step #2 is marked "Optional" (for HTTPS), and it also notes "Steps 8 through 10 are for Mail". You can skip them safely.

QUOTE (eandhra)
just found this link -- http://faq.sw-soft.com/article_41_894_en.html
very simple steps ..

That should work fine for basic HTTP domain aliases, where no Mail support is required. However, I do not know if that would count the domains against your licence, but I suspect it would.

.
Auroborus
QUOTE (miketyson)
I'm just wondering, how does this work with subdomains?  If I have subd.[parentdomain.com], how does one make that work with subd.[domain.com]? Does one have to add subd.[domain.com] to /var/named/run-root/var/[domain.com]?
It would be nice for users to be able to add subdomains through Plesk's control panel and have those subdomains work with their domain aliases too...
No, it will not automatically alias subdomains created through the Plesk control panel, because those subdomains load HTTP requests from their own subdirectory. However, to make it work you would NOT need to modify /var/named/run-root/var/[domain.com] because I take care of all subdomains with the wildcard line:
CODE
*.[domain.com].    IN A ###.###.###.###
Rather, you WOULD need to modify the file /etc/httpd/conf/httpd.domainalias.conf adding (using your "subd" example):
CODE
<VirtualHost ###.###.###.###:80>

ServerName [subd.domain.com]

DocumentRoot /home/httpd/vhosts/[parentdomain.com]/subdomains/[subd]/httpdocs

    <Directory /home/httpd/vhosts/[parentdomain.com]/subdomains/[subd]/httpdocs>

 AddType application/x-httpd-php .php .php4 .php3 .phtml

 php_admin_flag engine on

    </Directory>

</VirtualHost>
This could be automated if there was some way to do an "if file exists" within Apache conf files. Does anyone know of such a command?
polis
I have set up an alias however when I try to access the cgi-bin directory (domain.con/cgi-bin) I get a 404 Not Found error. I have set up a symlink in the httpdocs folder of the parentdomain to the cgi-bin directory but this again did no work. Any suggestions?
Auroborus
QUOTE (polis)
I have set up an alias however when I try to access the cgi-bin directory (domain.con/cgi-bin) I get a 404 Not Found error. I have set up a symlink in the httpdocs folder of the parentdomain to the cgi-bin directory but this again did no work. Any suggestions?
Hmm... Not sure, but try adding this code to your "httpd.domainalias.conf" file:
CODE
SSLRequireSSL

Options -Includes -ExecCGI
after the line
CODE
php_admin_flag engine on
polis
I tried adding the code but I got a syntax error "Illegal Option Includes".
fnsnoop
I cant seem to get multiple domains to work, only one. what should the httpd.domainalias.conf file look like with multiple domain domains in it.

I get the default plesk page here http://www.latenightaustin.com/
Auroborus
QUOTE (fnsnoop)
I cant seem to get multiple domains to work, only one.  what should the httpd.domainalias.conf file look like with multiple domain domains in it.

The httpd.domainalias.conf file should just look like a bunch of VirtualHost sections (from Step #2) one after another (with a few line breaks between) for however many aliases you set up.

You say the first one is working? Do you mean that one alias is working, or that only the parent domain is working? If the former is true, my guess is you have a problem with the ServerName and/or ServerAlias lines of the httpd.domainalias.conf file. If the latter is true, then there might be a problem with the include line in Step #3.
polis
I had set up a domain alias a couple of months back which worked fine but for the lack of any access to the cgi-bin directory.

The problem it turns out is that when Plesk sets up a new domain name, it places the cgi-bin directory in the same parent directory as the httpdocs and then redirects all calls to the /cgi-bin/ to the proper location. It does this by including a ScriptAlias command in a separate httpd.include conf file it creates for each new domain name. So when you manually set up a domain alias in Plesk and want to refer to a parent domain already set up in Plesk, you need to manually set up the redirection for the new domain alias to the proper cgi-bin directory.

Anyway, if you have this problem, what you need to do is simply to add the following line in the httpd.domainalias.conf file before the closing tag:

ScriptAlias /cgi-bin/ /home/httpd/vhosts/[parentdomain.com]/cgi-bin/
lvalics
Also you can use Power Toys for PLESK.
Free add-on on http://www.web-hosting-control-panel-addon...ys_for_PLESK/1/
HuffnPuff
Thanks for the tip on Power Toys. I don't use cgi on this site so haven't tested, but it did exactly what I wanted it to do. Aliasing on Plesk made easy. Extra great for me 'cuz I use external DNS...

Much thanks!
Auroborus
PowerToys seems great in theory, but I've tried to install it on two servers (running 7.1.4 and 7.5.2 respectively) and it screwed up both of them. If you can get it to work, 'power' to you, but I think I'll stick to doing it manually until some rainy day comes when Plesk decides to finally build it in.
lvalics
Probabbly is not the best solution, but is used on over 500 servers as we counted.
Unfortunatelly not work on all servers :-((, problems popup depend on OS.
eysmed
Hi every body, and very new with plesk and this the solution that i'm looking for, i'd like add a subdomain in my [parentdomain.com] and add an alias [mydomain.com] to a [subdomain.parentdomain.com].
I think i know how configure easilly addin the sub in the plesk control and after follow the step described here.

So my big question is, after doing that how can create emails account to mydomain.com, example info@mydomain.com and how can i administrate password, quotas etc for those alias accounts?

I will apreciate your answers?

I use plesk 8.0.0 on FREEBSD

Thanks in Advance
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.