Solved

Redirect to secondary private network server

Posted on 2009-05-12
4
562 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 W
  • 3
4 Comments
 
LVL 30

Accepted Solution

by:
Kerem ERSOY earned 500 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 W
ID: 31580805
Yep. Worked like a charm. Thanks!
0
 
LVL 30

Expert Comment

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

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

777 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