Topic: Redirect servers IP to hostname.domain.tld in nginx
==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.4.2
- Deployed with iRedMail Easy or the downloadable installer? installer
- Linux/BSD distribution name and version: Debian Buster
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Pro
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
Hi there,
typing in my servers IP-address in the browser shows my a security-warning, since the IP is not part of my SSL-certificate. If i accept the warning nginx redirects without problems to roundcube etc ...
I'm trying to redirect the servers IP to the FQDN, but i'm stuck and kind of nginx-newbie. I tried to add this statement at various position in the server{}-block of /etc/nginx/sites-enabled/00-default.conf and 00-default-ssl.conf:
if ($host = 111.222.333.444) {
return 301 https://mail.example.com$request_uri;
}
It works on another server without problems, but it doesn't here and there is no entry for that in the logs.
Any ideas?
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.