No IP address specified for Apache virtual servers

Hello,

Each time I am creating a new virtual server through Virtualmin I have to manually correct the Apache’s conf file for the new domain or subdomain.

The conf file created by Virtualmin always starts with <VirtualHost *:80>. With such config, the requests to the newly created domain don’t reach it, but go to the default website of the IP instead. In I add SSL website in the features, the SSL part has the IP address <VirtualHost x.x.x.x:443> and requests go to the right server in SSL.

However I need to manually add the IP address for port 80 <VirtualHost x.x.x.x:80> to achieve the same result on port 80.

I use Virtualmin for years, and these problems arised quite recently. I installed a new Virtualmin on a VM with the script installer.sh and left the default configuration to check if the problem wasn’t caused by my tweaks. I am getting the exact same result in this config.

Is there any way to force the IP address in the VirtualHost tag?

Thanks

Description:

  • Install virtualmin from scratch with install.sh on Ubuntu 14.04
  • Add a new Virtual server
  • Add an index.html page in /home/new_server/public_html
  • Reach new domain from browser: Apache Forbidden message
  • In Virtualmin, go to the new server > Website Options > check “Default website for IP address?”
  • Reach new domain from browser: it works
  • Create new Virtual server
  • Reach new domain from browser: previous added website appears
  • Change new server conf file first line from <VirtualHost *:80> to <VirtualHost x.x.x.x:80>
  • Restart Apache -> it works

I’m guessing Virtualmin didn’t detect the network address during installation for some reason (maybe this is a virtual machine of some kind with oddly named network interfaces?). You can manually set an IP address in the “Virtualmin Configuration->Network settings->Default virtual server IPv4 address”.

Thanks, but the IP is correctly configured. I see it in the network settings and in the website settings (Virtual Server main page, DNS settings, and “Change IP address” page).
It is just not added to the Virtual host config for non SSL. Again, for 443 I see the IP, but for 80 I get *:80

There is a new option in Virtualmin to force this behavior (using IP). I don’t know exactly how it determines the behavior by default (I think it looks at existing virtual hosts, but that isn’t really a useful indicator).

You can find it at System Settings->Virtualmin Configuration->Defaults for new domains->Address format for Apache virtual hosts