Default Server/IP

So still a newbie here unfortunately…

So i have site1.com and site2.com with my registrar(cloudflare) and the DNS entries have all the admin, webmail, @ and www pointing to my system’s IP…

Well I only have a virtual server running for site1.com, but when you go to site2.com, it takes you to site1.com…how can i avoid this. If i ever intend to have someone else’s site on my server, i dont want people getting routed to the wrong site.

There’s a FAQ about this: Website Troubleshooting – Virtualmin

All scenarios listed there are correct:

  • I have site1.com listed 4 times from the grep -i 'virtualhost' /etc/apache2/sites-enabled/*.conf (2 ipv4 entiers and 2 ipv6 entires for 80 and 443)
  • Network interface for virtual address set to eth0
  • Network interface for virtual address set as “From Network Interface”
  • Default IP address for DNS record - not behind a NAT router…i am on AWS lightsail

Note: site2.com is not a created virtual server on the host, just my DNS records are pointing to the public IP. Shouldn’t that return the default virtualmin server i have set up?

Now i do see in the grep command that it is showing the internal AWS lightsail address and not the public IP address…would this be the issue?

And what is the default virtualmin server that you have set up, if not site1?

Since:

You have only site1 created as virtual server in Virtualmin and it is therefore automatically the default virtual server.

No, but also yes.

If you only have one public IP, but I think you’re saying you have a bunch of internal IPs configured in your Apache config. That can’t possibly work.

The private IP should be what is in the Apache configuration. But, if you only have one public IP, you obviously can only have one private IP, with anything resembling a simple Apache configuration (there are convoluted ways to make multiple IPs work with a single public IP, but it doesn’t make sense to do that).

So i elected to skip the setup of a default server to begin with…so I made site.com, then came back in and made virtualmin.site1.com as the default server.

But when i type in site2.com into a URL field, it takes me to site1.com

Makes sense. I only have one public and one private IP. But the tourbleshooting items you linked me too are set correctly.

That’s fine…

From this, you have two virtual servers in Virtualmin:

  1. site1
  2. virtualmin.site1

And you have made virtualmin.site1 the default virtual server. Yet, site1 appears to be functioning as the default virtual server, i.e. site1 shows when you visit site2.

The only way that can happen is if site1 is indeed the default virtual server. Could you check if this is the case and also post a screenshot of Virtualmin → Server Configuration → Website Options for virtualmin.site1

Lifesaver! Thanks. Yea, to me that seems like a tiny bug that might need to be addressed…

I elected to not set a server as the default but VM selected the first server I made as the default.

Changing this setting fixed the issue.

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.