Guide to using multiple domains


#1

Hello,
I would like a box to host the e-mails from several different domains, including domain aliases.

It would be great if it were created in the Setup Guide a section teaching how to do this.

Before this section exist, can anyone help me please?
I’m lost. Do not even know where to start.

Thank you!

EDIT: I’m using Linode.


#2

You just need to follow the instructions in the Nameservers section under Configuring Your Domain Name in the setup guide. Then just create mail users/aliases @ that domain name in the /admin page.

Not sure what you mean by domain aliases. If that’s whole domain => whole domain forwarding, I don’t think it’s supported now but it could be.


#3

Very nice!!! Congratulations on the excellent work!

It is so easy that even seems to be just that. So then failed to make clear is that simple. :wink:

What I mean by domain alias is as follows:
A company has two domains - mydomain.com (main) and mydomain.net

If an email is sent to user@mydomain.net will be automatically directed to user@mydomain.com

Enjoying the contact, another question is about the possibility of accessing webmail using a subdomain, for example wembail.mydomain.com

Is it possible? What should be done?

Many thanks.


#4

accessing webmail using a subdomain, for example wembail.mydomain.com

No that’s not possible.

If you get Mail-in-a-Box working and really need domain aliases, please open an issue on the github project so I don’t lose track of the request.


#5

Just so I understand better and not spend time breaking head: it is a technical limitation that makes it impossible to use a subdomain or is your choice to make things as generic as possible?


#6

Anything is technically possible. It’s not something the box is capable of doing.


#7

I really do not understand why the default access is through a “folder”.

You can set the subdomain webmail for all domains using a setup similar to this:

# Redirect all HTTP to HTTPS.
server {
        listen 80;
        listen [::]:80;

        server_name webmail.*;
        root /tmp/invalid-path-nothing-here;
        rewrite ^(.*) https://$host$1 permanent;
}

# The secure HTTPS server.
server {
        listen 443 ssl;

        server_name webmail.*;

        ssl_certificate /home/user-data/ssl/ssl_certificate.pem;
        ssl_certificate_key /home/user-data/ssl/ssl_private_key.pem;
        include /etc/nginx/nginx-ssl.conf;

        # Expose this directory as static files.
        index index.php;
        root /usr/local/lib/roundcubemail/;

        location = /robots.txt {
                log_not_found off;
                access_log off;
        }

        location = /favicon.ico {
                log_not_found off;
                access_log off;
        }

        # Roundcube Webmail configuration.
        rewrite ^$ / redirect;
        rewrite ^/$ /index.php;
        
        location ~ /config/.* {
                # A ~-style location is needed to give this precedence over the next block.
                return 403;
        }
        location ~ /.*\.php {
                # note: ~ has precendence over a regular location block
                include fastcgi_params;
                fastcgi_split_path_info ^(/.*)()$;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME /usr/local/lib/roundcubemail/$fastcgi_script_name;
                fastcgi_pass php-fpm;
                client_max_body_size 20M;
        }
}

#8

It’s simpler: no extra DNS records, no SSL certificate to buy.


#9

But with LetsEncrypt is free. Where is the problem?
If webmail were in subdomain, I could set on domain’s DNS zone only the subdomain for webmail.
However, I must to enter to genericdomain.com/mail for all domains webmails. This is not apperars cool/good for the customers’ view.

What problem will occur to set webmail on subdomains if the LetsEncrypt is free?


#10

Josh doesn’t want to implement this feature - if you want it, code it, PR it on github, and then you can support this specific feature :slight_smile:


#11

Also: if the HTML is hosted on your mailinabox simply using:

example1.com/mail
example2.com/mail
example3.com/mail

all works. If it is hosted elsewhere: use PHP + Rainloop :wink:


#12

There is an easy way to setup rainloop without broken MIAB setup to run it on the same host or we need an additional host for rainloop?


#13

Hi! You’re in luck - I made a tutorial earlier this week on how to do this IN Mail-In-A-Box:
https://discourse.mailinabox.email/t/howto-unsupported-rainloop-in-nextcloud-miab-v0-26-only/?source_topic_id=160