Help for More WEB Servers in LAN

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Help for More WEB Servers in LAN

Postby Bobbix » 01. November 2014 20:18

Hi,
I've more than one Web Server in my LAN.
My need is to reach the right server indicating a specific url from internet (or from lan too).

My scenario:
XAMPP 1.8.2.2 on a Windows 7 Machine directly connected to the router and visible from internet.
Web Server 1 in LAN, IP 192.168.1.41, with three sites on it /joomla /phptest /other
Web Server 2 in LAN, IP 192.168.1.43, with two sites on it, /application1 /application2 (Java applications, so on Tomcat listening on ports 8080 and 8081).

My need is to realize this.....
typing url http://mydomain.com/joomla i want to reach /joomla on Web Server 1
typing url http://mydomain.com/phptest i want to reach /phptest on Web Server 1
typing url http://mydomain.com/other i want to reach /other on Web Server 1
typing url http://mydomain.com/app1 i want to reach /application1 on Web Server 2 (port 8080)
typing url http://mydomain.com/app2 i want to reach /application1 on Web Server 2 (port 8080)
... and so on ...

I've already attempted to configure reverse proxy googling but for example now i reach /joomla site but without the correct css and others elemets.

Can you help me to configure Apache (XAMPP) on the Windows 7 Machine to match the desired scenario?
Thanks.
Bobbix
 
Posts: 5
Joined: 01. November 2014 19:55
Operating System: Windows 7 64Bit

Re: Help for More WEB Servers in LAN

Postby detectiveconan » 03. November 2014 06:47

anyone has the answer?
detectiveconan
 
Posts: 1
Joined: 03. November 2014 06:37
Operating System: Windows 8

Re: Help for More WEB Servers in LAN

Postby Nobbie » 03. November 2014 11:20

This is definately impossible, you cannot reach different servers (different IPs) with the same domain name.

You only can configure one PC as (public) server, which handles all requests coming in for mydomain.com, and then use "Reverse Proxys" for the different URLs / folders for the other servers. Technical this means, that only one server can actually be reached (mydomain.com), but this server will retrieve the contents of (for example) http://mydomain.com/app1 from Server 2 and pass it thru to the client. But Server 2 cannot be reached directly. Later on this "looks like" as different servers are accessed directly, but this is only virtual - only one server interacts with the client.

Bobbix wrote:I've already attempted to configure reverse proxy googling but for example now i reach /joomla site but without the correct css and others elemets.


If you are mapping different folder names (for example you map /app1 to /application1 on Server 2), there can happen very nasty things and you have to overcome lots of problems. Here is a very good and complete tutorial, which shows and explains all difficulties, that may occur when running Reverse Proxies:

http://www.apachetutor.org/admin/reverseproxies

P.S.: I personally recommend ALWAYS to use VirtualHosts and to map / on /, this works in most cases "out of the box" with the basic configuration. To do so, you need two VIrtualHosts for each application (like joomla), one "external" VirtualHost and one "internal" VirtualHost. I will give you an example for Joomla:

a) in Xampp Apache you have to define a VirtualHost which is assigned to this Server, for example joomla.mydomain.com. You need a second VirtualHost, now on Server1 (which can be reached only internally), lets call it joomla.server1. You have to assign 192.168.1.41 to joomla.server1 in the Hosts files of your PCs (at least in the Xampp Server), whereas joomla.mydomain.com have to be a public Domain (ask your provider) which yields to you Routers WAN IP.

On Server1 (where Joomla actually is installed) create a VirtualHost and assign DocumentRoot to the joomla installation:

<VirtualHost 192.168.1.41:80>
ServerName joomla.server1
DocumentRoot /www/htdocs/joomla <== this is only an example, replace by the real Joomla Path
...
</VirtualHost>

You probably have to install Joomla after to joomla.server1 or reconfigure an existing installation (in order to use joomla.server1 as Domain)

On Xampp you define the external VirtualHost and install a ReverseProxy to joomla.server1:

<VirtualHost *:80>
ServerName joomla.mydomain.com
ProxyPass / http://joomla.server1/
ProxyPassReverse / http://joomla.server1/
</VirtualHost>

Thats all. If Joomla runs correctly under http://joomla.server1/, it *should* run now via http://joomla.mydomain.com/ as well (especially from outside).
Nobbie
 
Posts: 13182
Joined: 09. March 2008 13:04

Re: Help for More WEB Servers in LAN

Postby Bobbix » 03. November 2014 17:18

Thanks for your reply. Thanks a lot Nobbie.

I don't have external DNS that i can configure for each internal application (that can change a lot of times and day by day also).

Now i can reach my network from internet only with a Public IP or a Domain Address (like DynDNS).
I'have read about virtualhost but my question is "can i use this without having a domain like joomla.mydomain.com" ?
There is a complete guide to the virtualhost with Apache that i can read?

There are other solutions to match my scenario needs?

Thanks.
Bobbix
 
Posts: 5
Joined: 01. November 2014 19:55
Operating System: Windows 7 64Bit

Re: Help for More WEB Servers in LAN

Postby Nobbie » 03. November 2014 22:26

Bobbix wrote:I'have read about virtualhost but my question is "can i use this without having a domain like joomla.mydomain.com" ?


Of course not, as VIrtualHost means having multiple different Domains for one Server.

Bobbix wrote:There is a complete guide to the virtualhost with Apache that i can read?


Of course, lots of guides, first of all the original Apache Documentation about VirtualHosts.

Bobbix wrote:There are other solutions to match my scenario needs?


Yes and no. You may of course try to configure the Reverse Proxys as (very well!) explained in the tutorial i applied. And no, as my recommended solution is the easiest way to avoid all kind of problems as explained in the tutorial.
Nobbie
 
Posts: 13182
Joined: 09. March 2008 13:04

Re: Help for More WEB Servers in LAN

Postby Bobbix » 03. November 2014 22:35

OK, i will try first using some free ddns like dyndns, noip, ...
Thanks for your tips.
:wink:
Bobbix
 
Posts: 5
Joined: 01. November 2014 19:55
Operating System: Windows 7 64Bit

Re: Help for More WEB Servers in LAN

Postby Bobbix » 04. November 2014 22:32

OK Nobbie!
IT WORKS! Great!
I've succefully configured virtualhost and now i can reach my internal web server without problems.

Thanks a lot for your suggestions. Very appreciated.
Bobbix
 
Posts: 5
Joined: 01. November 2014 19:55
Operating System: Windows 7 64Bit


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 137 guests