Avatar of Philip Thomas
Philip Thomas
 asked on

2 websites hosted on premise

I have 2 webistes hosted on-premise. Can I point to both of them using the same outside IP, or would each require their own IP address?
NetworkingMicrosoft IIS Web Server

Avatar of undefined
Last Comment
Dan McFadden

8/22/2022 - Mon
giltjr

Simple answer, they each need their own IP address.

More complex answer, if you don't mind specifying a port number on one of them (http://host1.domain.com and then http://host2.domain.com:81) and your firewall can do port mapping, then you can share IP address.  If you had a layer 7 load balancer or a reverse proxy server, you could also share an IP address and the balancer can send to the correct host based on the host name.
Dr. Klahn

Using Apache,as many sites as you wish can be hosted on one IP address using the VirtualHost option.  Incoming HTTP requests are sorted by the web site name in the request header, and then "routed" to the correct vhost.

Note that there are a few restrictions associated with this.  One is that all sites must be running in the same server process, and the other is that if secure HTTP is used, the use of HTTPS must be uniform across all vhosts.

NameVirtualHost *:80
# This VirtualHost is used for requests with no server name.
<VirtualHost *:80>
DocumentRoot /www/localhost
#                    (www).example1.com
<VirtualHost *:80>
ServerName www.example1.com
ServerAlias example1.* www.example1.*
UseCanonicalName on
DocumentRoot /www/example1
</VirtualHost>
#                    (www).example2.com
<VirtualHost *:80>
ServerName www.example2.com
ServerAlias example2.* www.example2.*
UseCanonicalName on
DocumentRoot /www/example2
</VirtualHost>

Open in new window

giltjr

If you are using IIS (which you imply that you are) IIS calls Virtual Hosts Host Headers.  This only works if both sites are hosted on the same IIS Server.  I was assuming that you had 2 separate IIS servers.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Dan McFadden

You can host hundreds of sites on a single IP is you specifically binding all sites to the same IP address AND you must then use the host names fields on each site binding.  The host name must match the FQDN that is resolvable in DNS.

Dan
Philip Thomas

ASKER
Yes, both sites are on the same IIS server.
ASKER CERTIFIED SOLUTION
Dan McFadden

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.