Redirect IP to domain help

Hello. Sometime ago I configured webmin or virtualmin (I dont know in which one there is the option) to redirect my VPS IP (for example 1.255.654.567) to my domain. So for example, if I put my server IP on Google it will redirect automatically to the domain.
Everything fine, but now I want to undo this change and turn off the redirection, so it doesnt redirect anymore the IP to the domain, but I dont know where is the option. I know that the option is in Virtualmin or webmin, but it dont know exacttly where.

Im using ubuntu 20.04, apache 2.4, webmin/virtualmin.

Hello?, someone can help me please?

After the thing is turned off, what do you want displayed when the IP address is entered in Google Chrome?

The IP. So if I put for example it shows my website and the IP in chrome

And you don’t expect it to show a website? That’s not a redirect. That’s Apache doing what it’s always done. The first best matching virtual host (according to Apache’s somewhat opaque logic) is what it will serve for the bare IP.

In Virtualmin, you could create a new virtual server and make it the default virtual server: then the content that you put in public_html of that virtual server will show in Google Chrome when your IP address is entered in the address bar / omnibox.

So, enter in Chrome and see content of new virtual server - not your existing virtual server / website.

Note that the content of your existing virtual server will be visible only when the domain name(s) associated with the existing virtual server is entered in the address bar / omnibox, which I suppose is what you want.

I will try to explain myself the best. The title is just the opposite that I want to do. I mean, at this moment if I put in the browser it will automatically redirect me to my domain, then I will see in the search bar the domain and not the ip. Well, this option is activated by mistake by touching an option in virtualmin / webmin, AND WHAT I WANT TO DO IS TO TURN OFF THIS OPTION, and stop redirecting to my domain. So, once I turn off the option, if I put in my browser it will NOT redirect me to, and I will see in the search bar.

I have no idea. It doesn’t make any sense to care about this. Virtualmin isn’t explicitly configuring a redirect here, and as far as I know, it isn’t an explicit redirect. It is Apache doing what it normally does in a name-based VirtualHost configuration.

I can’t imagine a situation where you would need to use the IP of the server, and, Apache will show one of your websites when you hit the IP. So, set the default website to be the one you want, if it isn’t already, and move on. You’re obsessing over something that doesn’t make sense. You don’t need to use IP addresses. We live in the future where names can be automatically mapped to IPs via DNS and the web server can determine what site you want based on the hostname in the request header.

Maybe it’s possible to create a VirtaulHost where the ServerName is the IP address but that seems dark and terrible. I think you should stop all this before you go mad.

Also, I don’t think you ever configured a redirect as you think you did. There isn’t anywhere in Virtualmin or Webmin where you can configure “redirect IP to domain” (at least not without writing the redirect rule explicitly), because that’s not a thing people do. There definitely isn’t a button for it (there is a way to set the “default” site, but that’s not a redirect, that’s making the default site the first in the list Apache sees, so that it chooses it when nothing else is a better match because Apache chooses the best-first match for a request).

I know, i know. But for example Im trying to install cacti, I already installed it but now I have to go to to continue with the installation, but, it redirects me to I want the default configuration!!

Ah. You’re asking the wrong question, entirely. In the future start with the problem you’re trying to solve, not what you think the solution is.

You have a couple of choices here:

  1. Install Cacti into a Virtualmin managed VirtualHost (in /home/domainname)
  2. Create a VirtualHost that points to where Cacti lives.

Your Apache is in VirtualHost mode. It no longer serves the non-VirtualHost DocumentRoot. Once you add a single VirtualHost, the DocumentRoot (usually pointed to /var/www) stops working and cannot be made to work again without making a VirtualHost for it. This is not a Virtualmin thing. This is how Apache works.

I still need a solution to my problem. I want it to return to the default configuration, where if you put the IP address of the virtual server in the browser, it will show you the IP address, and not to redirect you to my domain. Is there any way that I can send you the IP address of my virtual server privately so that you can see the problem?
Also sorry for my bad english.

You cannot do that without removing all VirtualHosts.

I’ve told you how to solve the problem. Apache is now in virtual hosting mode. The only way to make it not be in virtual hosting mode is to delete all virtual hosts (and never add them again, as long as you want to keep using the IP).

I think you misunderstood. Also thank you very much for trying to help.

You reckon it’s me that misunderstands?

Yes, can I send you my vps ip in private?

No. I’ve told you how to fix it.

nice virtualmin staff team

You’re getting help for a free product, right?

Also, as soon as you add a site in Virtualmin that site will be served when entering the IP.
The same applies for nginx btw, the first site to match will be served when hitting the IP.
You want to change the default behaviour of Apache? I suggest you ask them instead.

lol, c’mon, I’ve gone to great lengths to help you. I can’t make Apache behave the way you believe it should. The answer to your problem is a few comments up. Literally, take two minutes to do what I told you to do (either option is fine), and solve the problem.

Or, keep complaining because I won’t…I don’t even know what you expect me to do here. Do you want me to modify Apache to work the way you think it should work? What? What could I possibly do other than tell you how to solve your problem?

so you are telling me that, by default, apache redirect the IP to domain?
So if I put by default apache will redirect to lol