I have a small Ubuntu 16.04.3 email server and I choose the easiest way using IRedMail. Email and Roundcube now works for my primary domain, but I'm having problems adding a new domain. Let's say I have olddomain.com and newdomain.com.

  • I configured DNS at my DNS provider

  • I added newdomain.com in IRedMail Admin panel

  • I generated a key using:

      amavisd-new genrsa newdomain.com.pem

and if I run "amavisd-new testkeys" I get:

TESTING#1 olddomain.com: dkim._domainkey.olddomain.com => pass

TESTING#2 newdomain.com: dkim._domainkey.newdomain.com => pass

  • I think I did not touch the nginx configuration
  • Restarted everything

Now if I browse to mail.newdomain.com to use Roundcube I get redirected to mail.olddomain.com. I'm not sure if this is the default behavior, but it's not what I would prefer. I would like email users of newdomain.com be able to use Roundcube on mail.newdomain.com. How can I set that up?

  • Hm.. my question might also belong to the Superuser SE..
    – user568021
    Commented Dec 15, 2017 at 10:52
  • Sounds like a silly question, but have you tried curling it instead of using your browser to check that the redirect isn't cached?
    – Big T
    Commented Dec 20, 2017 at 11:58

2 Answers 2


Actually, all you need to do is to create another virtual host in Apache or another server block in Nginx for the new mail domain. However, the Apache/Nginx directory structure is heavily modified by iRedmail, which makes the process a little complicated.

To see the exact steps for Nginx, check out my iRedMail tutorial: https://www.linuxbabe.com/mail-server/set-up-iredmail-multiple-domains-nginx

  • Problem solved. Thanks. IRedMail modifies nginx confinguration a lot and that was the reason I was so lost.
    – user568021
    Commented Dec 21, 2017 at 14:57

I think you need to create configuration files for the new domain.

In case you have one installation of Roundcube to serve multiple domains hosted on one server you can create host-specific config files. These files have to be named like .inc.php and are saved in Roundcube's config directory.

Check this link

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .