Skip to content

nginx redirect from www. to mail_domain doesn't work #914

@ygguser

Description

@ygguser

In the nginx logs on the server you can see lines like these:

Apr 08 11:06:28 5434386.internal nginx[4173]: 2026/04/08 11:06:28 [warn] 4173#4173: conflicting server name "www.chat.example.com" on 127.0.0.1:8443, ignored
Apr 08 11:06:28 5434386.internal nginx[4174]: 2026/04/08 11:06:28 [warn] 4174#4174: conflicting server name "www.chat.example.com" on 127.0.0.1:8443, ignored

For simplicity, you can restart nginx and immediately check its status; these lines will appear there:

systemctl restart nginx
systemctl status nginx

This nginx warning means that the same server_name is declared multiple times on the same IP:port, and nginx ignores one of them.

There is also another point I would like to draw attention to.

Usually, the file /etc/nginx/nginx.conf contains the configuration for the entire server (It usually does not contain site configurations).

Configurations for all websites are typically placed in the directory:

/etc/nginx/sites-available/

For the sites that should currently be enabled, a symbolic link is created in:

/etc/nginx/sites-enabled

Example:
If there is mysite.conf in /etc/nginx/sites-available

to enable it you run:

ln -s /etc/nginx/sites-available/mysite.conf /etc/nginx/sites-enabled/mysite.conf 
systemctl restart nginx

This is quite convenient.

However, in chatmail the configuration of all sites is contained directly in /etc/nginx/nginx.conf.

Also, after nginx installation the default site is enabled.
That is, in /etc/nginx/sites-enabled there is the default file (default is the site configuration file included with nginx).

I think this is something worth paying attention to.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions