1

Topic: iRedMail with multiple (non mail-related) domains

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.6 MYSQL edition.
- Linux/BSD distribution name and version: Ubuntu 16.04 Xenial
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): nginx
- Manage mail accounts with iRedAdmin-Pro? No
- Related log if you're reporting an issue:
====

Hello.

I just installed iRedMail, and it seems to work just fine. However, I want it only working at mail.mydomain.com, and currently nginx is redirecting all requests from all domains resolving to my ip to https://domain/mail/ .. It seems iRedMail nginx configuration is taking  over everything.

From what I see all nginx related config for iRedMail is located here: /etc/nginx/conf.d/00-default.conf, and the server name is defined as such: server_name _;

I thought that renaming it to
server_name mail.mydomain.com;
would make it work, but no...

Finally, note that adding sites to /etc/nginx/sites-available and /etc/nginx/sites-enabled does not make any difference neither.

Anyone can help me on this?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: iRedMail with multiple (non mail-related) domains

nuno wrote:

I thought that renaming it to
server_name mail.mydomain.com;
would make it work, but no...

It should work if you set "server_name mail.mydomain.com;". What do you mean not work here?

Is A type DNS record of 'mail.mydomain.com' pointed to this mail server?

nuno wrote:

Finally, note that adding sites to /etc/nginx/sites-available and /etc/nginx/sites-enabled does not make any difference neither.

Check /etc/nginx/nginx.conf, it doesn't include /etc/nginx/sites-{avaialble,enabled} at all.

Note: next iRedMail release (0.9.7) will use these 2 directories.

3

Re: iRedMail with multiple (non mail-related) domains

ZhangHuangbin wrote:

Is A type DNS record of 'mail.mydomain.com' pointed to this mail server?

Yes, and indeed mail.mydomain.com does work, the problem is ALL domains are being taken over by iRedMail configuration. So mydomain.com is also redirected to mydomain.com/mail for instance ...

I thought that changing
server_name _;  to server_name mail.mydomain.com;
would constrain this, but seems not to be the case.

How can I constrain iRedMail to only work on mail.mydomain.com ?

4

Re: iRedMail with multiple (non mail-related) domains

nuno wrote:

So mydomain.com is also redirected to mydomain.com/mail for instance ...

Does your mydomain.com config file contain valid root directory (the document root)?

5

Re: iRedMail with multiple (non mail-related) domains

ZhangHuangbin wrote:
nuno wrote:

So mydomain.com is also redirected to mydomain.com/mail for instance ...

Does your mydomain.com config file contain valid root directory (the document root)?

Yes.

johndoe@slowasus:/etc/nginx/sites-enabled$ ls
default

with the default contents being:

  root /var/www/html;
  index index.html index.htm index.nginx-debian.html;
  server_name mydomain.com;
  ...

and indeed

johndoe@slowasus:/etc/nginx/sites-enabled$ls /var/www/html/
index.html  index.nginx-debian.html  robots.txt


not sure what am I missing..

6

Re: iRedMail with multiple (non mail-related) domains

Ah!

Figured it out by re-reading my answer smile

It seems iRedMail also edits the contents at /var/www/html/. Indeed index.html contains a redirection to /mail

Thanks!