How to add custom sites best?


#1

Hello again

So yeah when I enter the site where Mail-in-a-box is installed we all see this default output:

this is a mail-in-a-box

take control of your email at https://mailinabox.email/

Planning here to deploy some nodejs driven websites on the same site. What’s the best way to do this without messing up with the default nginx setup of Mail-in-a-box? Don’t want to touch user-data home but have it in www-data or something like that.

Thanks heaps
M


#2

I have read everywhere that you should not deploy anything else on the server -> you need to create your another machine for this. You then setup DNS to the sites you need to point to this second server.


#3

So here’s the thing, we have a “machine state” that we prefer Mail-in-a-Box users have, so that it is easier to provide community support, since you don’t have a bunch of outrageous modifications to a machine.

That doesn’t mean we aren’t nice and kick you to the curb if you make some minor changes here and there, but the more modifications you make, the more people find it difficult to help you (hence, don’t want to sometimes).

Now, I am not an nginx expert, but I think it would be reasonable to make a small modification to redirect or proxy traffic to another server where your nodejs, if you are not comfortable with using a different Fully Qualified Domain Name (FQDN) than what your mailinabox server is using.

If you don’t understand what I’m saying, let’s say you bought example.com. You have a theoretical unlimited amount of FQDN’s for example.com, since you can create sub-domains ( www.example.com, mail.example.com, server-1.mail.example.com, being examples ). You can use each domain for a different server.

So my question is, which domain are you wanting to use Mail-in-a-Box for, and which domain are you wanting to use your nodejs stuff for? Will they all have the same domain? If they will be on the same domain, you will need to modify Mail-in-a-Box’s nginx configuration, which is technically an “unsupported” modification. Like I said earlier, “unsupported modification” basically means “if you can, avoid doing this”.

Now, you can have mail sent/received on a different domain than it appears. If you have mail.example.com as your MIAB domain, you can setup an A and AAAA ( see IPv6 necessary? recommended? or don't bother? ) that points to server1 (“server1” will be your MIAB box), but have an MX record for example.com point to mail.example.com, which points to server1 (according to your A/AAAA record), so that mail users get/send from example.com, but their web interface would have to be mail.example.com. Then, you can have nodejs (“server2”) be on example.com and have example.com’s A and AAAA records point to server2, without an unsupported modification.

Anyways, it all depends on the setup you want. This sounds like it depends on how you want your DNS set up, and if what I said sounds Greek, we can help you walk through your DNS options a bit more.


#4

the answer is simple.

  1. Setup a SECOND VM/VPS for the website(s)
  2. Login to your MIAB and set a custom A record (No subdomain!) for example.com,Make the value the ip for the second VPS you made. Should look like this:

Once set, let DNS propagate for a few minutes and now “example.com” will use the new IP, this WILL NOT touch other DNS records. So mail will flow perfectly fine.


#5

@murgero, you sure did simplify the process. I kinda did ramble on a little bit there, lol.


#6

Wonderful. You all have answered my question. Thanks heaps guys!