Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sorry if the question is unclear. I have two sites which I would like to set up in Apache2 on Ubuntu Server. Both of them should be open to the public. I would like to set up a separate IP for each of them (which I already did). I set up my router so that it forwards requests on port 80 to one of the IP addresses. How can I configure my setup so there is a way to access the other IP address?

share|improve this question

3 Answers 3

If you have a second public IP and a NAT router which can support either a range of public IP addresses or multiple IP addresses, otherwise most simple NAT routers can not.

Most folks actually set up multiple "virtual domains" to host different web sites under the same IP/web server combination.

share|improve this answer
    
I have a linksys router. What do you mean by "virtual domain"? –  Lenny K Jun 12 '11 at 17:00
    
Lenny K, based on your comments thus far, it sounds like you are missing at lease a few key components in accomplishing what you have described. The biggest one may be the registered domains as most users are accustomed to accessing web sites via text-based URLs. Most typical Linksys NAT routers (they have quite a few) will fall into the "simple" classification where they are mainly targeted at proving Internet access versus hosting Internet services (e.g. web server). What are you ultimately trying to accomplish? –  user48838 Jun 12 '11 at 17:28
    
The server I am setting up will not be for users to access, therefor a domain is not needed. How would I know if my router falls into the "simple" classification? I have gotten my server to work before, I have just not been able to set up two public sites. Sorry for my lack of knowledge, I am new to this :) –  Lenny K Jun 12 '11 at 17:35
    
Look through your Linksys's WAN configuration options. Does it allow your to either specify multiple or a range/network of public IP addresses? As for the web site not needed a text-based URL, then you may be able to accomplish what you desire by setting up each "site" as a sub-folder off of the main IP-based URL as well. –  user48838 Jun 12 '11 at 17:39
    
I have 3 different Static DNS IP's that I can set up...and I also have an option which is the DHCP Server (which is enabled). How would I set up the VirtualHost for the sub-folders? To Apache, it would be just one site, correct? –  Lenny K Jun 12 '11 at 18:09

You want Virtual Hosts. Essentially, the HTTP request made by the client includes the domain name of the site they're accessing. So the Apache server knows what content to serve them.

--Christopher Karel

share|improve this answer
    
I don't have a domain registered for either site at the moment. Eventually, one of the sites will have a domain, but the other will remain just an IP. –  Lenny K Jun 12 '11 at 17:11
    
Also, my router only has one public IP. How would the user be able to decide which IP to connect to? –  Lenny K Jun 12 '11 at 17:19
    
In that case, you need to set up the virtual hosts to listen on different ports, and then use a different site on each port. –  Christopher Karel Jun 12 '11 at 17:39
    
So I could use (for example) port 80 on one site and port 8080 on another? –  Lenny K Jun 12 '11 at 18:10

Along the line of the answers that have already been posted, and to keep it simple:

In Linux I believe the parlance is Virtual Hosts, as Christopher posted in his answer. Essentially you run multiple web sites on one ip address and the web server sorts out which site the incoming connection is destined for.

In Windows IIS parlance, you would set the ip based web site (the one with no domain) as the default web site on your server and you would create a second web site using host headers for the "named" web site to differentiate between the "named" web site and the "unnamed" web site. Your router would be configured to forward incoming HTTP connections on the one public ip address to the server, which would then handle the connection appropriately, based on whether the connection were meant for the "named" or unnamed" web site.

You need to figure out if name-based virtual hosts and ip-based virtual hosts configurations can be "combined" on your web platform so that you can use both methods.

share|improve this answer
    
I am running Linux (Ubuntu Server). What I need to find out is what the server will use to distinguish the two site requests. I don't have Windows IIS, so I can't use that right? Also, I need the site to work WITHOUT the domain temporarily. Later, I plan to add a domain. Thanks for your help! –  Lenny K Jun 13 '11 at 20:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.