So, uh… I just played around with my Nginx configurations with inspirations I got from this post here, and out of curiousity I tried to bind the Virtualmin config specifically to Port 81 and now I can reach all of the sites without problem. I am pretty sure that makes the config worse overall, because I’d imagine having the Nginx config for Virtualmin specifically listen for Port 81 only, opens up a whole new world of issues… maybe? But maybe the knowledge helps with finding the issue.
Here is the modified config file:
server {
server_name mysite.net www.mysite.net mail.mysite.net webmail.mysite.net admin.mysite.net;
listen [::]:81;
root /home/mysite/public_html;
index index.php index.htm index.html;
access_log /var/log/virtualmin/mysite.net_access_log;
error_log /var/log/virtualmin/mysite.net_error_log;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME "/home/mysite/public_html$fastcgi_script_name";
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT /home/mysite/public_html;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS $https;
location ^~ /.well-known/ {
try_files $uri /;
}
location ~ "\.php(/|$)" {
try_files $uri $fastcgi_script_name =404;
default_type application/x-httpd-php;
fastcgi_pass unix:/var/php-nginx/xxx.sock/socket;
}
fastcgi_split_path_info "^(.+\.php)(/.+)$";
if ($host = webmail.mysite.net) {
rewrite "^/(.*)$" "https://mysite.net:20000/$1" redirect;
}
if ($host = admin.mysite.net) {
rewrite "^/(.*)$" "https://mysite.net:443/$1" redirect;
}
listen 443 ssl;
ssl_certificate /etc/ssl/virtualmin/1727805669753482/ssl.combined;
ssl_certificate_key /etc/ssl/virtualmin/1727805669753482/ssl.key;
}
By the way, port 81 isn’t even open to the Firewall, so no freaking idea why that works