Can it be done? two servers one IP

I’ve got one Virtualmin server up and running and it’s great! Now I want a second development/test/whatever server that I can use and abuse without taking down the production system.

What I’d like to do is direct http, ftp, pop3 traffic to the test or production servers based on its url. For example goes to the production server and goes to the test server. I only have one routable IP address provided by my ISP. The servers are on my private 192.168.x.x network.

What would it take to do this? It seems that the big boy hosting companies don’t have a one to one ratio of routable IP addresses to servers, or maybe they do.

1 Like

what exactly do you mean?
2 computers behind the router or two domains on 1 computer?
As for 2 computers I think you will have to run apache on a different port like 8080 and tell your router what to point to where ( for port 80 and for port 8080 for instance).

When 1 computer you would run mod_fcgid so you’ll have independend php.ini’s and such

Joe and Eric would have some better ideas I’m sure.

Unless your edge router is capable of parsing the URL request for you, the answer is no.

Yeah, as Ronald said, we could definitely use some more info.

But while you can do some fancy work with testing on a URL and the various related headers when dealing with web traffic, you can’t do the same thing with Email/POP/IMAP/etc.

That is, when connecting to an Email, POP, or IMAP server, the only thing the server sees is that there’s an incoming connection. It can’t tell what hostname was used to connect the same way Apache can when dealing with web traffic – the browser sends a special “Host Header” to allow that, but other protocols don’t do the same thing.

So you’re probably going to be out of luck in setting up multiple services if you only have one IP address.

Some alternative ideas:

  • Rather than try to be fancy, just setup a test server within a VMware Server instance on your desktop (or some other preferred computer). VMWare Server is free, so it won’t cost anything to get that up and running.

  • Buy a Linode or Slicehost (or whatever) VPS for $20, and setup your test environment there.

  • Ask your ISP if you can have a second IP; some would sell you a second one for a few bucks more a month.

I fully agree that it’s a great idea to have a test environment! In my case, I have a few VMware instances running on my laptop that I use for testing – I tweak Virtualmin settings, test distro upgrades, and other goodies with that.

Thanks, I think this answers my question. What I want is two physical servers behind one inexpensive “home” class router. From what I see here my router isn’t up to the task. I was hoping that it was a DNS setup that had to be done.

What kind of router would I need?

Well, the router isn’t so much to blame as is the protocols you’re hoping to use, and the fact that you only have one IP address.

If you get more than one IP, you’d simply need a router that supports two external IP addresses – at which point, you’d be able to do all kinds of fun port forwarding to do what you’re after.

So, here’s a question, do the big boy hosting companies have a one to one ratio (or more) of routable IP addresses to physical servers? I’ve seen hosts with hundreds if not thousands of url’s pointing to the same IP. I know there are a 1,000 variables, but it would seem that they should have the ability to move sites from server to server depending on the load. I know as a customer I would be very unhappy if I had to change my site’s IP address.

Well, there’s a few things going on here, and it depends on what protocol we’re talking about.

With Apache, no problem – you can setup as many websites as you want under one IP address. That’s simply a new Virtual Host, and you can do that with your current setup.

SMTP and POP and IMAP and friends don’t work that way. Your router can’t redirect a request to to one server or another based on what domain name a user is connecting to for SMTP/POP/IMAP.

For Apache, all you need is one IP and you can run as many websites as you want.

But what you’re asking for is to also do something similar for SMTP/POP/IMAP, and those don’t work that way. For those, you’ll need one external IP address per instance you wish to run (so if you want two SMTP services, you need two external IP’s).

In a commercial hosting environment, most users would never notice if their domains IP address changed. They have the nameservers for their registrar pointed to the hosting company, and said hosting company maintains the IP address list.

Virtualmin actually makes it trivial to change the IP address of a given domain.