Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Redirect to secondary private network server

Posted on 2009-05-12
4
Medium Priority
?
567 Views
Last Modified: 2012-05-06
Okay, here's the situation. I have a publicly accessible static IP address that currently has port 80 forwarded from the firewall/router to an internal private web server (i.e. 192.168.0.3) that is handling several websites via Virtual Hosts. This works like a charm without any issues.

I am in the progress on building a 2nd internal web server (i.e. 192.168.0.12) that will house only one 'testing' web instance. Since port 80 is already forwarded on the firewall to the primary web server, I would like to keep the virtual host on the primary web server, but redirect (proxy) all inbound http connectivity for this other domain name to the 2nd internal web server after seeing the entry on the primary web server.

Internet --> Firewall/Port Forward (Forward Port 80) --> Primary Web Server (Listen Port 80) --> mod_proxy --> 2nd Internal Web Server (Listen Port 80)

What do I need to do on the primary web server's Virtual Host entry to redirect all traffic to the 2nd web server while maintaining the domain name in the URL (i.e. not showing the user the site is being redirected)?

I thought of something like this, but I don't know if that would really work or not...

<VirtualHost *:80>
  ServerName myothersite.com
  ServerAlias www.myothersite.com
  ProxyRequests Off
  ProxyPreserveHost On
  ProxyPass / http://192.168.0.12/
  ProxyPassReverse / http://192.168.0.12/
</VirtualHost>

Open in new window

0
Comment
Question by:Michael Worsham
  • 3
4 Comments
 
LVL 30

Accepted Solution

by:
Kerem ERSOY earned 2000 total points
ID: 24370845
Hi,

Just try this:
<VirtualHost *:80>
  ServerName myothersite.com
  ServerAlias www.myothersite.com
  ProxyRequests Off
  ProxyPreserveHost On
  ProxyPass / http://192.168.0.12/
  ProxyPassReverse / http://192.168.0.12/
  DocumentRoot /usr/local/apache2/htdocs 
  Errorlog logs/www.myothersite.com.log
  CustomLog logs/www.myothersite.com.access_log combined	
</VirtualHost>

Open in new window

0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24371047
I'm using a similar setup and it works like charm : ) I'm sure it will work for you too.
0
 
LVL 29

Author Closing Comment

by:Michael Worsham
ID: 31580805
Yep. Worked like a charm. Thanks!
0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24372293
Yr welcome :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Integration Management Part 2
Suggested Courses
Course of the Month12 days, 12 hours left to enroll

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question