Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 13th July 2010, 22:39
ferra ferra is offline
Junior Member
 
Join Date: Mar 2010
Posts: 17
Thanks: 0
Thanked 2 Times in 2 Posts
Default http forwarding to another internal IP

I have server1 and server2. Server1 is conneted to internet with dns server and apache, serving 3 domains, abc.com, def.com and ghi.com. Ip address of server1 is 192.168.0.100.
server2 is an internal server running apache with 3 domains, xyz.com, tuv.com and qrs.com. Ip address of server2 is 192.168.0.101.
I want to have access of xyz.com from internet, so have to configure the dns of xyz.com on server1 and make apache redirect it to server2.
The apache configuration for xyz.com on server1 is:
<VirtuaHost 192.168.0.100>
ServerName www.xyz.com
ProxyRequests off
Proxyass / http://192.168.0.101
proxyPassReverse / http://192.168.0.101
</VirtualHost>

When I access www.xyz.com, server1 ir redirecting the ip address to server2, not the name server, so it gets the first domain in 192.168.0.101.
A solution for that is to give a second ip address for the nic on server2, and configure xyz.com on that ip address, for example, 192.168.0.102 and
on server1
<VirtuaHost 192.168.0.102>
ServerName www.xyz.com
ProxyRequests off
Proxyass / http://192.168.0.102
proxyPassReverse / http://192.168.0.102
</VirtualHost>

This way it works. is there another way to configure it?

Thanks.
Reply With Quote
Sponsored Links
  #2  
Old 15th July 2010, 17:50
geek876 geek876 is offline
Junior Member
 
Join Date: Jul 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think you are mixing name based virtual hosting with ip based virtual hosting. Try the below steps

(1) Put DNS entry so xyz.com -> 192.168.0.100
(2) So abc.com, def.com, ghi.com and xyz.com now point to .100 (server1) and the rest tuv.com & qrs.com point to .101 (server2).
(3) Create a new DNS entry ex: 123.com point to .101 (server2). This will be substitute for xyz.com
(4) Create virtual hosts abc.com, def.com ,ghi.com and xyz.com on server1 as below

Put below two lines somewhere under server1's apache main httpd.conf file and create a directory /etc/httpd/conf.d/virtual-hosts/ to hold virtual host config files.
NameVirtualHost *:80
Include /etc/httpd/conf.d/virtual-hosts/*.conf

(5) For each domain on server1, create virtual host config file under /etc/httpd/conf.d/virtual-hosts/abc.conf

<VirtualHost *:80>
ServerName www.abc.com
ServerAdmin email@domin.com
DocumentRoot /<document root for abc>

<other required options goes here>

Create /etc/httpd/conf.d/virtual-hosts/def.conf,ghi.conf and xyz.conf as above. However for xyz.conf add below lines to facilitate proxy

ProxyPass / http://www.123.com
ProxyPassReverse / http://www.123.com

(6) Create appropriate virtual hosts (tuv.com, qrs.com & 123.com) as above points (4) & (5) on server2.

PS: I am assuming you don't want https as apache only supports 1 virtual host with named based virtual hosting.

Hope this helps.
Reply With Quote
  #3  
Old 15th July 2010, 18:34
ferra ferra is offline
Junior Member
 
Join Date: Mar 2010
Posts: 17
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Thanks for your replay.
Don't forget, in server1 I have all the domains on the Internet, so the DNS entries for these domains all points to 88.73.84.201 (a public address example).
So, abc.com, def.com, ghi.com and xyz.com on server1 points to the public address, how can i configure another entry on the DNS of server1 telling DNS to points zyz.com to server2 (192.168.0.101)?
Can I have 2 DNS entries on server1 saying for xyz.com to pints to 88.73.84.201 and another one pointing to 192.168.0.101?
Reply With Quote
  #4  
Old 16th July 2010, 12:25
geek876 geek876 is offline
Junior Member
 
Join Date: Jul 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You do you want XYZ point to server2 too? Do you also want XYZ to be accessed (may be internally) directly from Server2 whereas access via Server1 is only for External Internet connections?
You could
(1) Have your internal DNS only pointing to server2 for xyz.com whereas external dns points to server1 for xyz.com, or
(2) Just access xyz.com as 123.com internally.
Reply With Quote
  #5  
Old 19th July 2010, 11:11
ferra ferra is offline
Junior Member
 
Join Date: Mar 2010
Posts: 17
Thanks: 0
Thanked 2 Times in 2 Posts
 
Default

thanks a lot.
Ok, I understund now your point.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Statistics not compiling. thevinster Installation/Configuration 137 11th November 2010 10:54
Http forwarding to another internal IP linuxisp Installation/Configuration 3 15th December 2009 15:36
Postfix + DKIM - Error in log donb01 Server Operation 2 24th July 2008 17:59
HTTP POST request over GPRS doesn't work. hiharsh Technical 2 23rd July 2008 16:52
Help Forwarding Incoming Requests to Other Internal Machines (not the web server) jkrell Installation/Configuration 16 27th October 2006 23:46


All times are GMT +2. The time now is 09:55.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.