Assigning a Dedicated IP Address to a Website

Posted: 2015-01-09 00:32:16

There are several situations where you would need to assign a dedicated IP address to a website.

But under normal circumstances, you can host 100s of websites, each using its own separate domain name and aliases, on the same exact single IP address – and even without having to directly assign that specific IP address to a website (on the web-server’s end, in the VirtualHost).

Once you assign a dedicated IP address to a website, any requests that come in on that IP address, will return only that specific website, regardless of the domain name used, and you will not be able to host other websites without an additional IP address.

Domain Based Hosting Vs IP Based Hosting

All URL requests (i.e., HTTP/1.1 requests) made by Browsers carry additional information in them, such as the “Host” Header, that the web-server can read. This “Host” Header specifies the requested domain name.

With modern Apache configurations (such as provided by WampDeveloper Pro), the way it works is that Apache reads the “Host” Header from the incoming request to get the domain name, and returns the proper website by matching that domain name to one of the websites Primary Domain Name or Domain Aliases… That is, once the request reaches Apache, no IP addresses are used to select a website.

Using Domain Based Hosting, after setting proper DNS for your domain names, everything else is taken care of automatically…

When a request from a Browser is made, the DNS system will resolve the domain name to an IP address, and the request will travel and route though the internet using that IP address, but when it reaches WampDeveloper Pro, Apache will simply read the “Host” Header (that is part of that incoming request) to get the domain name, and will then return the proper website (by matching that domain name with one of the websites).

To set up DNS, using the DNS control panel of your Registrar or DNS provider, assign each domain-name (including the “www” part, the base domain part, and any aliases) your public IP address via an “A” record. Then wait an hour for the global DNS system to update.

IP Based Hosting

There are several edge-cases and situations where Domain Based Hosting does not work 100% for everyone:

1. HTTP/1.0 requests do not contain the “Host” Header, which was introduced in HTTP/1.1. Some older or very simple programs, scripts, and bots, that visit or send requests to your website might still use HTTP/1.0 (or they just might make a direct connection without using DNS). In which case Apache will return the default (first loaded) website instead of the correct website.

2. Very old versions of Browsers (e.g., IE6) do not support SNI (Server Name Indication). And when those Browsers make an HTTPS request, since the “Host” Header is only decrypted and read after the SSL connection is established, Apache has no choice but to return the default (first loaded) website’s SSL certificate instead of the proper website’s SSL certificate. And the user is presented with a certificate mismatch warning and/or is prevented (for security reasons) from loading the website by the Browser.

3. Related to #2, aside from IE6, all versions of IE on Windows XP and Server 2003, Safari on XP, and some other earlier versions of other Browsers do not have native support for SNI, relying on the OS’s implementation of it. And Windows XP and Server 2003 did not provide an implementation of the needed system component for SNI.

4. Users, configuration policies, and some installed programs (such as McAfee) are able to disable some SSL and TLS protocol versions (on Windows), or their SNI extension, and occasionally do so for unknown reasons. Any Browser that does not use its own integrated implementation of the needed components will not be able to make an SNI enabled request in this situation.

Assigning a Dedicated IP Address to a Website

Edit the website’s HTTP and HTTPS VirtualHost files.

* Select your website in WampDeveloper’s Websites Tab, click the HTTP and HTTPS VirtualHost button.

Update this:

<VirtualHost *:80>

With this:


Save files. Restart Apache.