In keeping with the OP title and the related/stranded question posed by oz above, I'm endeavoring to add non-webmail websites to the same physical server where I currently have 9 mail domains smoothly operating
- iRedMail version: 1.6.8
- Deployed with iRedMail Easy or the downloadable installer? Donwloaded Installer
- Linux/BSD distribution name and version: Debian 12
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Not yet
I have a full compliment of tested SPF, DMARC, DKIM, A and MX records in place for each of the nine domains, and DNSSEC is likewise connected and tested with each domain.
I also setup Let's Encrypt certificates for each of the hosts within the nine domains and have tested them.
the following default /etc/nginx/sites-available/00-default-ssl.conf file is in place:
#
# Note: This file must be loaded before other virtual host config files,
#
# HTTPS
server {
listen 443 ssl http2;
server_name _;
root /var/www/html;
index index.php index.html;
include /etc/nginx/templates/misc.tmpl;
include /etc/nginx/templates/ssl.tmpl;
include /etc/nginx/templates/iredadmin.tmpl;
include /etc/nginx/templates/roundcube.tmpl;
include /etc/nginx/templates/sogo.tmpl;
include /etc/nginx/templates/netdata.tmpl;
include /etc/nginx/templates/php-catchall.tmpl;
include /etc/nginx/templates/stub_status.tmpl;
}
AND, I have created a file /etc/nginx/sites-available/mydomain.com.conf as follows:
#
# Note: This file must be loaded before other virtual host config files,
#
# HTTPS
server {
listen 443 ssl http2;
server_name mydomain.com;
root /var/www/mydomain.com;
index index.html;
}
I then enabled the non mail virtual server via the symbolic link:
ln -s /etc/nginx/sites-available/mydomain.com.conf /etc/nginx/sites-enabled/
Next I placed a simple "hello world" index.html file in the /var/www/mydomain.com directory.
NOW, I retested all the mail domains to make sure I didn't break what has been working fine, and all remained well.
THEN, Imodified the DNS records for mydomain.com by simply removing mydomain.com from the MX record, leaving the other hostnames in place.
I restarted the server, and again tested all the domains for normal web mail as well as POP/SMTP mail functionality and all was still good.
The the moment of truth, mail.mydomain.com still worked as always, what would mydomain.com do?
It appeared as though my changes weren't being applied, I thought, ah maybe I have to wait for DNS to propagate and clear browser cache, but NO, I could see that other DNS changes were taking effect immediately.
Then I had a hunch. I had noticed that the default Index.htm file in /var/www/html contained a redirect to /mail
<html><head><meta HTTP-EQUIV="REFRESH" content="0; url=/mail/"></head></html>
What if my new virtual server definition WAS being acted on, BUT, because this default index.html with the redirect was still being called prior to handing over control to the intended virtual server, instead of using the root= /var/www/mydomain.com/index.html file, it was actually looking for a file at root= /var/www/mydomain.com/mail/index.html ???
Easy to test, I created a mail directory under /var/www/mydomain.com/ , and placed another copy of the "hello world" index.html within that mail subdirectory. And, VOILA, the added virtual server definition was indeed being used and the test site is thus accessible!
This is not perfect, as clearly I am still at a loss as to why the original index.html is being called before following the added virtual server definition, OR how to fix this behavior.
Hopefully there's a simple solution here that I am just too dense to see so far--would someone be so kind as to offer explanation and/or assist?
Thanks All :-)