apache to redirect to different internal servers

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

apache to redirect to different internal servers

Postby timtsak » 18. July 2011 19:34

Hello to everyone,

I am new to apache configuration. I am thinking of implementing the following but not sure how:

I would like to have one server that will be accessible from the internet for example IP1.
I would like to have different server that host different web sites for example IP2, IP3. I know I could use virtual servers with Apache, but the problem is that for example for magento there are problems with LAMPP so I am thinking of running ZendServer in IP3.

The canonical name for the web site is as following:
IP2 name2.com
IP3 name3.com

In IP1 and IP3 I will run LAMPP but in IP1 only apache.

I want to have the following:
when someone hits the name2.com address the request will come to the IP1 and then apache should forward the request to IP2 (I want apache to translate the url from name2.com/... to IP2/...). The same I would like to have for the IP3.

Do you know how I can do that with apache LAMPP? I have tried using Redirect but this is actually redirect the url to IP2/... but IP2 is not accessible from the internet so doesn't work.
I also tried Alias but it didn't work too. I think alias is only for directories, like symlink, so is not translating the url as I want.

Would I have what I want by using Apache proxy? But for this one I will also DNS ? I am reading books but they are all messed up in my head!


Thanks,
Tim
timtsak
 
Posts: 2
Joined: 18. July 2011 19:25

Re: apache to redirect to different internal servers

Postby JonB » 18. July 2011 21:31

A. - this is a correct analysis
I also tried Alias but it didn't work too. I think alias is only for directories, like symlink, so is not translating the url as I want.

Alias is for folders (Directory) or Locations (URL's) within a logical server.
http://httpd.apache.org/docs/2.0/mod/mod_alias.html

B. If I understand your questions correctly, I think the Apache proxy should work. (if you intention is that IP1 is to recieve ALL the traffic)
A typical usage of a reverse proxy is to provide Internet users access to a server that is behind a firewall

http://httpd.apache.org/docs/2.1/mod/mod_proxy.html

C. Normally, you need a Canonical (C) entry in DNS for every hostname that cannot be resolved directly to an unambiguous IP exposed address. You can think of Canonical Names as DNS 'redirects' that occur at the host name level, and are transparent to servers.

I think you would need 'B AND C' to make it work.I hope this helps.

Note: Provided the hosts are in the same domain, you might also be able to do all this with .htaccess directives (mod_rewrite). You might even be able to do it with multiple TLD's - but you could run into issues with scripts (running into security measures) I think.

My two cents - the Proxy and DNS scheme is a more direct and more easily understood way to do it.

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: apache to redirect to different internal servers

Postby timtsak » 18. July 2011 23:30

Thanks for the reply and the useful information.
Do you know any GUI application for mac os or Linux? Would be easier to test this using an easy way before I get complicated with text configuration etc
timtsak
 
Posts: 2
Joined: 18. July 2011 19:25

Re: apache to redirect to different internal servers

Postby JonB » 19. July 2011 02:25

Personally, I'm not aware of any configuration GUI's that could do all the things you seem to want to do. (this would also be true on Windows with Apache). You are asking a server to do headstands, the only way 'Jon B' knows how to do that is with configuration files. :shock:

If setting up the proxy and the DNS fixes are too daunting, consider the mod_rewrite route. In that situation, you would only need 'standard' server configurations.
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html

Alternatively, you might also consider using virtual hosts based on local IP's and ports (just a thought).

Good Luck with your project.
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 29 guests