• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

How to create multiple domain name for the same website

D

Dj_Cure

Guest
hello,
is it possible to add multiple alias to a single domain? for example, if i want www.example.com and www.example.net to point to the same file. one solution is to add

<VirtualHost 62.193.232.27:80>
ServerName example.com:80
ServerAlias www.example.com
ServerAlias example.net
ServerAlias example.org
ServerAlias example.tv
UseCanonicalName Off

to the file /home/httpd/vhosts/example.com/conf/httpd.include
Is there any way to do this with plesk interface?

Thnx
 
You must add ServerAlias directive to /home/httpd/vhosts/example.com/conf/vhost.conf file.
There is no solution to add such line via web interface.
 
Thank you for your help.
I think this could be a nice feature to next plesk updates ;)
Lost of websites have many domain names which goes to the same files. With the httpd.include configuration modification, or with the new domain + 1 frame redirector it's hard to keep a track of all the domain names for each website. :(
 
Possible...if we're talking about the same thing...

You can set multiple domains to go to one domain by using "Standard Forwarding".
In the main control panel click "Add New Domain". Type the domain name. Directly below it is the drop-down option for "Select template." Click that and choose "Create domain without template." Click "OK" The next screen will be "Hosting type", click the "Standard forwarding" radio button and "OK" again. ( You can click "Help" on the far left to read about the different types but this is the most common choice and in most instances what you're looking for). The next screen is "Preferences." Type the URL that you want this to go to, then "OK" again.
 
>pbigordon

This way the domain is forwarded so the url will be changed.
I assume that this is not always wanted.

I Agree with Dj_Cure that this would be a nice feature for the next update. ;)
 
If you want the URL to stay the same you choose "Frame forwarding" instead.
 
Originally posted by SibProgrammer
You must add ServerAlias directive to /home/httpd/vhosts/example.com/conf/vhost.conf file.
There is no solution to add such line via web interface.

Yes, you re right. But then I cannot manage the emails for

example.com
example.net
example.org
etc.

What I can do with vhost.conf is only to "map" all these
domainnames into 1 directory. But this is only for HTTP
and not MAIL.

Where can I configure the emails? For example, that

pop3 of example.com
[email protected]

All emails of

[email protected]
[email protected]

should be automatically forwarded to

[email protected] (there is the POP3).

Thank you for a suggestion.
 
what i was thinking of ,
you could also create the other website in your plesk , and with the vhost.conf make them use the same directory

i assume if you use
DocumentRoot /usr/local/psa/vhosts/newdomain/httpdocs
it will use that instead of the original dir in the http.include file

didn't test , going to today i hope.
 
Originally posted by DaanK
what i was thinking of ,
you could also create the other website in your plesk , and with the vhost.conf make them use the same directory

i assume if you use
DocumentRoot /usr/local/psa/vhosts/newdomain/httpdocs
it will use that instead of the original dir in the http.include file

didn't test , going to today i hope.

Yes, this will work. Use vhost.conf for such solutions. But this
will be only a solution for HTTP and _not_ for MAIL, see my
last lines before. We need also a conf for forwarding the
MAILs or something like that. Hmm?
 
After creating the frame forwarded domains, the manual workaround for emails can be done by editing the /var/qmail/control/virtualdomains file.

Each domain you create gets assigned a prefix number.

If you want domain.com to be the 'master' and the .net, .org, etc to all go to the .com, then you would change the prefix numbers of the .net, .org, etc to the same number as the .com

Currently there is no way (that I know of) to do it from the Control Panel, but you can do this via SSH root login to a shell prompt.

Edit: Updated this info to be current and correct. My original post was way off, I must have been having a non-mental day...
 
Is the major advantage of this method:

<VirtualHost 62.193.232.27:80>
ServerName example.com:80
ServerAlias www.example.com
ServerAlias example.net
ServerAlias example.org
ServerAlias example.tv
UseCanonicalName Off

That you dont use your domain licenses or is still affected due to having to have DNS for each domain?

thanks
 
Originally posted by editor
Yes, this will work. Use vhost.conf for such solutions. But this
will be only a solution for HTTP and _not_ for MAIL, see my
last lines before. We need also a conf for forwarding the
MAILs or something like that. Hmm?

uhm , that's not entirely true i think.
Since the domains are inside plesk , the mail will be handled by plesk.
but if you want [email protected] also to work on domain.tv , then you'r right , that won't work my way.

that has to be done in the database as jamesyeeoc wrote

Is the major advantage of this method:

<VirtualHost 62.193.232.27:80>
ServerName example.com:80
ServerAlias www.example.com
ServerAlias example.net
ServerAlias example.org
ServerAlias example.tv
UseCanonicalName Off

That you dont use your domain licenses or is still affected due to having to have DNS for each domain?

thanks

well , since most of us , (that might include you) have plesk also running as dns , than the serveralias wont work.
i don't know exactly how plesk counts it domains , but by dns would be an option i guess
the point is , with server alias you would have to run a dns somewhere else for those domains.
 
By D

well , since most of us , (that might include you) have plesk also running as dns , than the serveralias wont work.
i don't know exactly how plesk counts it domains , but by dns would be an option i guess
the point is , with server alias you would have to run a dns somewhere else for those domains.

Does anyone know if plesk counts a domain (in license terms)
by the DNS? Or in fact how does plesk define a domain?

Thanks
 
Originally posted by editor
Yes, you re right. But then I cannot manage the emails for

example.com
example.net
example.org
etc.

What I can do with vhost.conf is only to "map" all these
domainnames into 1 directory. But this is only for HTTP
and not MAIL.

Where can I configure the emails? For example, that

pop3 of example.com
[email protected]

All emails of

[email protected]
[email protected]

should be automatically forwarded to

[email protected] (there is the POP3).

Thank you for a suggestion.

If you want to just have the emails from the other domains simply delivered to a chosen one then simply add the other domains into the rcpthosts in qmail/control, so that the system knows they are valid email addresses and add a line in virtualdomains with the same prepend number as the site you want.

so if examplecom appears in virtualdomains as

example.com:42

then add lines

example.net:42
example.biz:42
etc

So far I cannot find a method to access the emails using the other domain names but all emails to the same name get delivered to the one account and it can be acceesed via that account.

Then restart qmail.
 
Hi jamesyeeoc

Originally posted by jamesyeeoc
Manual workaround for emails can be done either by modifying the mySQL database using something like phpMyAdmin or even Webmin; or using CLI commands to mysql.

Each domain you create gets assigned a prefix number.

If you want domain.com to be the 'master' and the .net, .org, etc to all go to the .com, then you would change the prefix numbers of the .net, .org, etc to the same number as the .com

Currently there is no way (that I know of) to do it from the Control Panel, but have done this via phpMyAdmin and Webmin.

I had again a look because of this theme. I am sorry, I am
still a little bit confused how to solve this problem.

example.com
example.net
example.org
for HTTP, this is clear and can be configured by uploading
a vhost.conf into the /conf/-directory of the domainname
example.com.

But how again can the emails be forwarded? Thank you for
a hint. :)
 
Here is how I do it.
BACKUP BACKUP BACKUP
I am not responsible for any problems that may arise from following these instructions. I am not an expert, but hey it works for me. Please let me know if there are any security issues as I am paranoid. Also does anyone know if these files get overwritten with a Plesk or software upgrade.

pico -w /home/httpd/vhosts/[domain.com]/conf/vhost.conf

add ServerAlias domain.net

run update command
/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=domain.com

pico -w /var/named/run-root/etc/named.conf

add new zone for domain.net (easiest way is to copy zone for domain.com and replace all refs .com to .net)

restart named
service named restart

FOR EMAIL
either add domain.net to rcpthosts or add to morercpthosts

pico -w /var/qmail/control/morercpthosts

add domain.net

rebuild qmail database
/var/qmail/bin/qmail-newmrh

add domain.net to virtualdomains to receive email for domain.net through domain.com
pico -w /var/qmail/control/virtualdomains
add domain.net:11 (where number is the same as that for domain.com)

if you wish to reject bounced messages for domain.net you need to edit your .qmail-default for that domain.

cd /var/qmail/mailnames
add domain.net folder - check permissions/owner
add .qmail-default file
pico .qmail-default

add following line
|forward ${DEFAULT}@domain.com

add domain.net to rejection list
pico -w /var/qmail/control/rejectnonexist
add domain.net

service qmail restart

DONE
if you do not add a .qmail-default file but add domain.net to rejectnonexist then all email for domain.net will bounce.

Now if you have [email protected] mailbox all mail to [email protected] will go into that box. You should be able to read mail using either domain.com or domain.net mail addresses. Remember they are one in the same.

Roo
 
hi roo,

thank you for that great thread! so i tried as you have written, but...:

Hi. This is the qmail-send program at server01.xyz.com.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.

<[email protected]>:
Sorry, no mailbox here by that name. (#5.1.1)


any idea...?
 
Wow I forgot about this thread. My original post has been modified to reflect the correct changes needed for forwarded domains.

You basically have to modify the /var/qmail/control/virtualdomains file.

You will see the 'master' domain and it's prefix number. Change the other 'slave' or 'forwarded' domains prefix numbers to be the same as the master domain's prefix number.

You still have to have all the domains listed in the /var/qmail/control/rcpthosts file.
 
hi,
thx for fast reply!

but something doesn't work anyway!

so.. .what i did....:

in plesk i made virtual hosting for domain.com. the e-mail configuration in plesk sends all mails (catch-all) to [email protected].

now, in /vhost.conf of domain.com i added "ServerAlias www.domain2.net".

in /var/qmail/control/rcpthosts plesk ads domain.com and i added manually domain2.net

then in /var/qmail/control/virtualdomains plesk has written domain.com:20 an i have add manually domain2.net:20

thats all...
if i write now an e-mail to [email protected] i get back:
Sorry, no mailbox here by that name. (#5.1.1)

????????

remember: domain2.net has NO account in plesk!
 
After making the changes, you need to restart Qmail. Either from the control panel, or from the command line (service qmail restart).

Until Qmail is restarted, it will not re-read it's control files.

Hmm, I don't see in your earlier post where you stated which part of this thread you had done or not done. Many different things have been discussed. Regardless of whether you created domain2.net in Plesk or not, if you have done the serveralias and the changes to Qmail's rcpthosts and virtualdomains file, AND RESTARTED APACHE AND QMAIL, then it should all work.

Basically manually making the ServerAlias and Qmail changes is bypassing Plesk's domain counting, which I don't believe to be against their AUP (since these domains are not being controlled by their software). No one touched on having to make manual changes to /etc/named.conf or the DNS zone files for the non-Plesk controlled domains.

I do not recommend doing any of these things since Plesk will overwrite the files when changes are made to any domains in the control panel (Apache, Qmail, Bind/Named, etc) and your manual changes may be lost without notice.

One thing not clearly covered in this thread is that somewhere on some nameserver, the MX records for domain2.net have to be pointing to your Plesk server, or the DNS lookups for the domain will not be served by a valid nameserver, unless you are using an external nameserver to hold that domain's DNS records.

Also, since you are bypassing Plesk and making manual changes, I don't recall anyone in this thread warning about Plesk re-writing the Apache or Qmail files whenever any changes are made to domains in the control panel, which may cause your manual changes to be 'lost'.

Assuming you have done this at the domain registrar level, and have manually made all required changes and restarted all services, it should work.

I do have backup (store and forward) MX servers where I manually add the extra Qmail changes and the domains are not defined in Plesk, only in the Qmail files (requires additional changes to smtproutes and rcpthosts), and nothing even in the Apache files since it is ONLY for email backup.
 
Back
Top