[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

2 servers on 1 ip

Right now i'm on a cable connection, with a dlink router and a single apache2 server running. I want to put another server up, on the same ip. What would be the easiest way to do that? Can I setup a virtual host in apache on the already existing server to point to an internal ip on the network? or is there an easier/more efficient way to do this?
  • 2
1 Solution
yes, you can do it using Name based Virtual hosts. I use it on my PC. I have two sites running on the same IP.
Example of config:
Listen 80
NameVirtualHost *:80
<VirtualHost *:80>
    DocumentRoot "c:/web/site1"
    ServerName server1.dnsalias.net
    ErrorLog logs/server1-error_log
    CustomLog logs/server1-access_log combined

<VirtualHost *:80>
    DocumentRoot "c:/web/site2"
    ServerName server2.dnsalias.net
    ErrorLog logs/server2-error.log
    CustomLog logs/server2-access.log combined

Keep in mind that you should have two correct DNS names that point to the same IP address. You can do it using dnsalis.net domain. They offere DNS names for free.
engel32Author Commented:
hmm.. don't think that was interpreted correctly..  I already have plenty of virtualhosts setup for subdomains and alt domains.. but I want to run 2 completely different servers on 2 completely different computers, but we only have the 1 ip coming into the network...  I just need a temp fix til we go to dsl and can have more than 1 ip.
you can try to use proxy module of Apache. So you create new virtual host on your existing Apache server, but add ProxyPass parameter which will retrive data from another webserver:
ProxyRequests on
ProxyPass / http://foo.com/

Example config
details on http://httpd.apache.org/docs/mod/mod_proxy.html#proxypass

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now