IP-based apache

Hello,

I decided to setup IP Based Apache virtual hosts on Centos 5.4 (yum updated) with Virtualmin, because I need a lot of SSL websites. But I faced problems - even sitting on this for whole day, I can easily make name-based host with shared ip, but not IP based. My server is on LAN (192.168.0.20) and I have router with public IP. I have done sequence in Virtualmin written below:

  1. Server templates > Virtual IP address > range 192.168.0.40-192.168.0.200
  2. Create virtual server (domain.com)> IP address and forwarding > Network interface > Virtual with allocated IP. Get virtual server with eth:0 192.168.0.140, also see that network interface got this ip.
  3. Bind configuration has all domains and subdomains with this ip. Also I tried to disable named service and write ip’s to hosts file.
  4. Upload index.html file to public_html directory
  5. Theh I hit http://domain.com (or www.domain.com), I get

Index of /
Name Last modified Size Description



Apache/2.2.3 (CentOS) Server at www.domain.com Port 80

But if i delete virtual interface through virtualmin and put virtual server on my shared address everything is work just fine - i can see my index file content.

I tried to create more IP based servers but the result is the same. I try to read forums, posts and etc. everywhere the solution is quite simple - need just create virtual ip, has dns or hosts entry and create virtual host in apache httpd.conf But in my case it is not working. Could someone give the directions where to look deeper?

Thank you.

Did you add those IP’s to: virtualmin - Addresses and Networking - Shared IP Addresses? I would try that first.

Ronald, thank you for answer.
Actually, I don’t. I saw this place, but is it not for name-based settings? It is written:

The primary purpose of this page is for entering additional IP addresses that can be used by virtual servers that do not have their own private IPs. Each IP entered must be already active on the system (which can be done in the Webmin module Network Configuration), and cannot be used by any other reseller or private IP virtual server.

Or I don’t understood something?

I have done some experiment and create server under 192.168.0.140 virtual ip through Virtualmin. Then I go to webmin and create antother virtual ip 192.168.0.141 on real network interface.

  eth0:1 	Ethernet (Virtualmin) 	192.168.0.40 	255.255.255.0 	Up
  eth0:2 	Ethernet (Virtual) 	192.168.0.41 	255.255.255.0 	Up

As you suggested, I went to Addresses and Networking - Shared IP. If i tick “Allocate a new shared IP address” in textbox appears ip 192.168.0.41 which is not used by virtualmin…

what I did is added an IP to the networking setting under webmin as a virtual iface eth0:1
Then added it to Addresses and Networking
Then made a Virtual Server with that IP
I do not have “Allocate a new shared IP address” enabled.
When creating a virtual server I checked:
Network interface
Shared, on non-default IP And choose an IP from there

It worked fine for my system.

I tried the technics of yours, but unfortunately I got the same blank screen with "Index of / " and that’s it… I have router with public ip with configured necessary ip forward to server with local ip. Does your configuration the same? Or do you have server with public IP or NAT 1:1?

I can not figure out why when i just put the server on default shared address 192.168.0.20 everything is going fine…

I have my servers in a datacenter and dont have routers to worry about.
you can check in virtualmin - System Settings - Module config and scroll to Networking settings.

Make sure that “Network interface for virtual addresses” is set to detect automaticly
Default virtual server IP address is From network interface

also select the domain in virtualmin, go to Server Configuration, go to Change IP Address and see how it is set there or may be change it to the correct IP