Access Mailbox From A Subdomain

I am not sure if this is possible. But I think that would be great, if I can access my mailbox by typing:

mail.domain.com which leads to box.domain.com/mail

Especially for my familiy would that be a great feature, they are all not that techie and I want it to be as easy as possible for them to acces their email accounts. Actually that should just be some lines in the nginx config isn’t it? Cause as far as I know, that redirect is not doable with DNS. Am I wrong?

Dont know about nginx config.
But quick n dirty i would create the subdomain mail.domain.com and
place a index.html file in the static webhosting directory that redirects
the user to box.domain.com/mail.

@nate as @ibib said, the best option knowing we can’t use a .htaccess file (not apache installed) and the option of customizing /etc/nginx/conf.d/local.conf will force us to re-edit it each time we’ll upgrade MiaB then, the best way I see to achieve this is by using a custom /home/user-data/www/default/index.html file as follows:

<!DOCTYPE HTML>
<html lang="en-US">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="refresh" content="1;url=https://box.yourdomain.com/mail">
        <script type="text/javascript">
            window.location.href = "https://box.yourdomain.com/mail"
        </script>
        <title>Page Redirection</title>
    </head>
    <body>
        If you are not redirected automatically, follow this <a href='https://box.yourdomain.com/mail'>link to /mail</a>
    </body>
</html>
  • Edit it by replacing box.yourdomain.com by your own server_name.

  • Note we are using a meta, and a javascript redirections plus a link inside the index.html static file that should make the desired redirection to work well within any browser.

Hope this helps!

3 Likes

Wow, that works like a charm. Thank you so much - perfect, at least for me! :wink:

try check this one. Best way to redirect root page to /mail?

@aa6my : Yes, works too! but as said /etc/nginx/conf.d/local.conf file will be reset to default after each Miab update or upgrade :stuck_out_tongue_winking_eye:

1 Like

Jep, the solution from @just4t just worked in a matter of seconds. And that I don’t have to care, when an update comes is even bber. :wink: