Question

How to setup srv1.domain.com, srv2.domain.com with mutliple domains per VPS

  • Posted September 11, 2014

Hi,

I want to setup this: VPS 1: hostname srv1.mydomain.com VPS 2: hostname srv2.mydomain.com

On both VPS-es I want to host like maximum 5 websites. For all the websites I want mailserver per site. Like mailserver hostname is: mail.website1.com and for the second website on VPS 1 it would be mail.website2.com.

I know how to setup a VPS with mutliple domains (done this using VirtualMin), but how to set up multiple VPS-es where the hostname is a subdomain / hostname of my purchased domain (srv1. or srv2, etc.). How would I setup mail correctly per server?

I now was thinking about this as DNS for mydomain.com: srv1.mydomain.com points to Droplet 1 (A record) srv2.mydomain.com points to Droplet 2 (A record)

In DOs DNS manager I have set-up a add a new website for every website on srvX. The A records of this website redirects to either VPS1 or VPS2 depending on what srvX the website is on.

This seems to work, but now: how to setup mail? (just the DNS settings, I already set up mailservers with postfix and dovecot)

Should I just add mail.websiteX.com per website, which points to a specific VPS? Because I have read that the VPS name has to be the mailserver name for the PTR record to setup correctly. That would make it impossible to add multiple mail.websiteX records?

Thanks!

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

On DO environment you have many ways to do this… but I list two

you need to choose the default VPS-es domain… Pratic example

VPS1 vps1.domain1.com

VPS2 vps2.domain1.com

When you rename your vps to this names automatically this point to your vps IP, this is PTR record

vps1.domain1.com PTR xxx.xxx.xxx.xxx vps2.domain1.com PTR xxx.xxx.xxx.xxx

When you create DNS records for domains like:

domain1.com MX 5 vps1.domain1.com domain2.com MX 5 vps1.domain1.com domain3.com MX 5 vps1.domain1.com

domain4.com MX 5 vps2.domain1.com domain5.com MX 5 vps2.domain1.com

AND TXT SPF records you use something like “v=spf1 mx ~all” this allow vps1 hosts to send mail for your domains. Are necessary? Not, but prevents that messages will be marked as spam.

Other way to do this are:

domain1.com MX 5 mail.domain1.com domain2.com MX 5 mail.domain2.com domain3.com MX 5 mail.domain3com

domain4.com MX 5 mail.domain4.com domain5.com MX 5 mail.domain5.com

And yours respectives “A” records and TXT SPF record something like “v=spf1 ip:xxx.xxx.xxx.xxx ~all” or “v=spf1 include:vps1.domain1.com ~all”

A think thats help you!

Regards

On DO environment you have many ways to do this… but I list two

you need to choose the default VPS-es domain… Pratic example

VPS1 vps1.domain1.com

VPS2 vps2.domain1.com

When you rename your vps to this names automatically this point to your vps IP, this is PTR record

vps1.domain1.com PTR xxx.xxx.xxx.xxx vps2.domain1.com PTR xxx.xxx.xxx.xxx

When you create DNS records for domains like:

domain1.com MX 5 vps1.domain1.com domain2.com MX 5 vps1.domain1.com domain3.com MX 5 vps1.domain1.com

domain4.com MX 5 vps2.domain1.com domain5.com MX 5 vps2.domain1.com

AND TXT SPF records you use something like “v=spf1 mx ~all” this allow vps1 hosts to send mail for your domains. Are necessary? Not, but prevents that messages will be marked as spam.

Other way to do this are:

domain1.com MX 5 mail.domain1.com domain2.com MX 5 mail.domain2.com domain3.com MX 5 mail.domain3com

domain4.com MX 5 mail.domain4.com domain5.com MX 5 mail.domain5.com

And yours respectives “A” records and TXT SPF record something like “v=spf1 ip:xxx.xxx.xxx.xxx ~all” or “v=spf1 include:vps1.domain1.com ~all”

A think thats help you!

Regards