Apache is tricky
I recently had to work on an Apache Web Server and had to bind a couple of IP Addresses to a site. There isn’t a UI for Apache. So for me to be able to bind an IP Address, it took some research. In IIS, there is an option to bind an internal and external IP Address to a site. So, going from IIS to Apache was definitely a challenging task. I would just get Apache to work and then it would break, but I have it this time.
In order to bind an IP Address in Apache, you have to edit the httpd.conf file. From what I have gathered, if you have an internal and external IP Address for one site you have to create them as Virtual Host. In the middle of my research, I did find that you would create a Virtual Host if you were wanting multiple sites using the same Port.
The picture below is an example of what I did to configure the Virtual host.. Let me explain it further. (This example configuration is for using Apache on a Windows machine)
Let’s say I have an Internal and External IP Address that I have to bind to one site and they are both using port 81.
You would start off with stating what the IP Addresses are and their port.
NameVirtualHost 188.8.131.52:81 (Pretend this is the internal IP Address)
NameVirtualHost 184.108.40.206:81 (Pretend this is the external IP Address)
Then we need to state the IP Addresses/ports and tell it where to look for that sites index. html file.
<VirtualHost 220.127.116.11:81 18.104.22.168:81> (This is your beginning statement. Doing this means you are telling Apache that you are referring to these Virtual Hosts)
DocumentRoot “C:\Program Files (X86)\XX/htdocs/” (This is where you tell Apache where your index.html file is. If you have a space in the path, you must put quotes around it. Also, you will notice that I went from back slashes (\) to forward slashes (/). I am not sure why it is set like that, all I know is that Apache will not be able to find the index.html file if you do not put in forward slashes. If I am putting up a sharepoint site and using Apache Web Server. The path in Windows may be C:\Program Files (X86)\SharePoint\htdocs\index.html. You would start using forward slashes after SharePoint. Also, you do not need to put in index.html in the path, You can end with the directory right above it, but make sure you keep the / at the end.)
ServerName SharePoint.apache.com (This is where you would put in the URL Name in for the site)
ServerAlias SharePoint (This is just an alias for the server. This will show up in the tab of your web browser)
</VirtualHost> (This is your ending statement)
It will look like this without all of my comments.
<VirtualHost 22.214.171.124:81 126.96.36.199:81>
DocumentRoot “C:\Program Files (X86)\SharePoint/htdocs/”