IP address opens one of my websites instead of var/www/html

Hi everyone!

When I enter IP address it opens up one of my websites … what I expect it to do is open var/www/html (for some demos to be put there)

What could be done here?

Thanks for great software in case some admin is reading this :wink:

You’re making an assumption about Apache that isn’t true. Apache has two modes of operation. IP-based (where all requests to the IP(s) it is listening on are served from one directory) or virtual host mode (where Apache checks the headers to figure out what site you want, with quite complicated and confusing logic when the name does not match a configured VirtualHost). Creating domains in Virtualmin puts Apache into virtual host mode. If you want it to serve something out of /var/www/html, you’ll have to manually create a VirtualHost that points to that directory.

But, that still won’t act the way you think it will…you can kinda emulate a “default site” by making sure the VirtualHost configuration you want to serve from /var/www/html is the first one parsed. But, this is still prone to confusing behavior.

It’s best to just create a domain that you want to be your “default” and stop thinking about IPs. Apache isn’t thinking of it the way you are, so it’ll only confuse you to try to make it think that way. :wink:

1 Like

I had similar issues when I started using Virtualmin. I was going to post a link to where this was explained to me, but I can’t seem to find it now. However, as Joe says, forget about /var/www/html and just create a domain inside Virtualmin and make it the “default” domain (Virtualmin -> DOMAIN -> Server Configuration -> Website Options -> Default website for IP address?) and treat /home/USER/public_html as your new /var/www/html.

1 Like

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