Single Server - Multiple Websites with assigned Public IPs

Alles, was den Apache betrifft, kann hier besprochen werden.

Single Server - Multiple Websites with assigned Public IPs

Postby clawwd » 11. September 2019 14:05

Hi everyone!

First, I am a noob doing my first multi-website Virtual Machine setup and I promise I am not being lazy by asking this but I am lost.

I have searched tons of stuff and nothing has matched up with exactly what I need.

I have 2 Public IPs I have been assigned by my Virtual Machine provider and I just want to host them on a single server but each bound to the appropriate IP that relates to the FQDN.

Everything I found so far was on virtualhosts so I think I am the right area of searching but I cant seem to find an example of using Public IPs for mulitple websites on the same server.

Does anyone have a simple config they can send me like this that you can send or paste...I really appreciate it!

Specs:
Windows Server 2016
Xampp 3.2.4
Apache 2.4.39 (win64)
MYSQL 5.0.12-dev
clawwd
 
Posts: 7
Joined: 11. September 2019 13:54
XAMPP version: 3.2.4
Operating System: Windows Server 2016

Re: Single Server - Multiple Websites with assigned Public I

Postby Nobbie » 13. September 2019 12:59

clawwd wrote:Everything I found so far was on virtualhosts so I think I am the right area of searching but I cant seem to find an example of using Public IPs for mulitple websites on the same server.


No, you dont need VirtualHosts for that. VirtualHosts are (mostly) required if you have only ONE Public IP but more than one Domain. For example. you have http://www.domain1.com and http://www.domain2.com, both running on 123.123.123.123 - and you want to serve different content for domain1 and domain2 (even if they both refer to the same IP), THEN you need VirtualHosts (NameBased VirtualHosts).

In your case, simply enter two LISTEN clauses into httpd.conf (one for each IP) and you are done:

Code: Select all
LISTEN 123.123.123.123
LISTEN 234.234.234.234


Or do you want to deliver TWO different sites (one for each IP)? In that case you have to look for "IP Based VirtualHosts" (simply provide the Public IPs in the VirtualHost Clause):

Code: Select all
<VirtualHost 123.123.123.123:80>
....
</VirtualHost>
<VirtualHost 234.234.234.234:80>
....
</VirtualHost>


See https://httpd.apache.org/docs/2.4/vhosts/ip-based.html
Nobbie
 
Posts: 13170
Joined: 09. March 2008 13:04


Return to Apache

Who is online

Users browsing this forum: No registered users and 17 guests