Strange redirects appearing & server IP redirect

Operating system Ubuntu Linux 20.04.4
Webmin version 1.984 Usermin version 1.834
Virtualmin version 6.17-3 Authentic theme version 19.84.7

Hi Guys,

Several issues. I’ve a server with the hostname,

http requests to which has no virtual host seem to forward requests to a specific different virtual server for no apparent reason. The same thing happens when the server IP is entered into a web browser, requests go to this same different domain too.

Would setting up a virtual host for, and also adding a redirect to that host, for the default apache2 domain fix this?

I had modified the main apache conf with the addition of ServerName but have now removed that, as it doesn’t seem to have fixed it. Are there any best practices, to stop these redirects?

Ideally, when or the server IP are http requests it should read something like this:


You don’t have permission to access this resource.

The same as the response gives.


A virtual host appears to have fixed that problem.

The server IP is still forwarding to a random domain though. Ideally, it should be going to ?

Sort of impossible to know without knowing what domain you’re actually talking about. We can’t check for ourselves to see what error we get or which server we connect to.

I can only guess that you don’t have your SSL configured properly. When you don’t, the server will default to a domain that does, which is typically the default domain of Virtualmin.

SSL is configured fine, the default hostname is also used for webmin.

There is no error, the server just forwards to a random domain.

Where is the default domain of virtualmin set or you’re referring to the default apache2 domain?

The guys here: Apache default VirtualHost - Stack Overflow are saying it’s pretty much a crap shoot depending on how the virtual hosts are ordered in the sites-enabled directory. I’ve checked the ordering, and the IP’s http forward still looks pretty random though.

You set your default domain by going to Virtualmin / the domain you want to be default / Server configuration / website options / default website of IP

Set that to yes.

As an experiment you should set a new default domain that is NOT the one you’re having issues getting to and then try again. If it forwards to the domain you just set as the default, then you probably have SSL and/or DNS issues.

Example using my domain:

Let’s say I can’t get to and that it keeps forwarding to another site. I go to my server and set a different domain as my default, such as Then I give that a few minutes to propagate and try to access again. If it forwards on to then I can bet I’ve got SSL/DNS issues.

It’s not going to give you an SSL error. It’s just going to forward automatically to the default domain of the server.

I never knew that setting existed. Thanks!

The default domain has now been set to opens fine SSL n all, BUT when entering the servers IP it throws up an SSL error in relation to connecting to (NET::ERR_CERT_COMMON_NAME_INVALID)

Other domains, when set as the default, don’t give this SSL error.

The host is on a VMnet but has a public IP, I’m guessing that may make a difference?

Question: Are you using the default self-signed SSL certificate? If so, that’s the problem.

No, LetsEncrypt.

Well, that should work. I can only guess that for some reason the certificate you have isn’t assigned properly.

Edit to add: Have you by chance copied that certificate to be used by Virtualmin?

Possibly, if so is there anyway to check or reset this?

If you go to that domain then go to Server Configuration / SSL

Down at the bottom you should see a button that says “Set as default services certificate”. If you do, click that and it will assign the SSL certificate to your services and that should get rid of the error.

Not all services were listed just FTPd and another, but I re-assigned it.

So, I then assigned another virtual server to “Set as default services certificate” which displayed all services.

Then back to where all services were listed this time, so I set as default again, but still no luck. I’ve also tried another server as the default using the host IP, and there’s no problem with it. Very strange. is a example, you not actually using that name?


1 Like

Hi Steve,

The issue is, when using the hostname/hostvirtualserver as the primary site for the hosts IP there’s an SSL error when resolving from the IP to the domain name and terminating an SSL connection, the certificates are correct but browsers throw up an invalid certificate error.

DNS is hosted on the server, and all other domains when set as the primary domain for the server IP work fine.

Other problems were resolved as detailed.

Really wasn’t the question I ask, I use to makes sure the domain name is setup correctly, maybe you missed something.

The DNS resolves fine in all other cases, just this with the SSL cert & apache, with the servers hostname and default apache host.

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