Link to home
Start Free TrialLog in
Avatar of Alan Dala
Alan Dala

asked on

One IP for multiple websites

Hi -

I recently moved some small web portals internally from a Colo and now I'm having some issues pointing to the right website from the outside. I'm able to bring the websites up internally(private IP) but externally, I'm having issues accessing them. How do I point to different websites on the same IP? Can it be done with NAT translation on the firewall or does it have to be done with DNS records(godaddy)?

thank you for your help!
Avatar of Brian Pringle
Brian Pringle
Flag of United States of America image

You will need to use host headers to be able to distinguish it on the server.  What platform are you using to host the Web sites?
Avatar of Alan Dala
Alan Dala

ASKER

Thanks for the answer. They run on Apache. The question is why it worked in the Colo on the same scenario (single IP) and not from the new public IP...

thanks again.
What you have described (different websites on the same IP) is the technique of
"Named Based Virtual Hosts".

This is documented at: Apache Foundation Doc: Named Base Virtual Host Support

Basically you configure the httpd daemon on the addressed host to recognize the names as opposed to the DNS system.

From that doc:
The first step is to create a <VirtualHost> block for each different host that you would like to serve. Inside each <VirtualHost> block, you will need at minimum a ServerName directive to designate which host is served and a DocumentRoot directive to show where in the filesystem the content for that host lives.

If the document root for the virtual host is on a different physical server, then you need to use
redirection to send the request on to that other host.

Out side of configuring the httpd server, there may be techniques you can use that involve configuring the router or other magic.   Your previous co-located service may have used something like that, but unlikely.

In any case, this is a particularly complex area of http configuration.   The link above is the reference
for the Apache Http Server.
Avatar of Lee W, MVP
It worked at the colo because the web server was setup properly.

IIS it's called host headers - you set them for the web site and the server responds when someone visits that web site.

In apache, it's virtual hosts - see https://httpd.apache.org/docs/current/vhosts/examples.html
# Ensure that Apache listens on port 80
Listen 80
<VirtualHost *:80>
    DocumentRoot "/www/example1"
    ServerName www.example.com

    # Other directives here
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/www/example2"
    ServerName www.example.org

    # Other directives here
</VirtualHost>
Considering that I just transferred the VMs from one place to another, I assumed it was done at the router/firewall/dns level since it stopped working after the transfer.

thanks!
When you say "VMs", are these on one virtual machine or are they housed on separate virtual machines?  If they are on separate virtual machines, then it would be up to the firewall to route them based on host headers (domain).
You need to provide us with DETAILS.  You didn't mention the web server or how you moved them... after assuming certain common things, you tell us no, thats not it because I did this...

If you want this solved quickly, you need to provide details and not make us guess what you did/how you had things setup.
Sorry, yes, they are on different VMs. What I did is transfer the VMs from one host to another. I can bring the websites up on the private IPs but cannot from the outside. I have only one public IP address.
They all run on Apache. Two Linux machines and one Windows.

Thanks
Hi There,

Could explain with an example?
It would help us in understanding and providing a solution.
@Alan Dala - Any update on getting this working, yet?
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.