Solved

Apache Mod_Proxy problem with virtual housts

Posted on 2004-08-27
5
327 Views
Last Modified: 2013-11-15
Hi

I'm in the process of setting up two public webservers behind a firewalled connection.  I've gotten to the point where I've forwarded port 80 to one of the machines (which I will henceforth call the 'first webserver') and used mod_proxy to redirect a domain request to the other machine (the second webserver).

My problem is.... How do you set up multiple Virtual hosts on the second webserver?  I'm no apache expert, but I can see that the ProxyPass directive is translating the domain into my internal ip and serving up the pages that way.  However, how do I pass a directive to the other machine that will differentiate it from, say, me merely plugging my second webservers' internal ip into my browser?

No matter what <Virtual Host> information I put in the second webserver, the page that is served up from a domain request proxied to that machine is (naturally) the same page that would be served up if I entered http://192.168.x.x in my browser.

Can anyone help me with this?  Thanks in advance.






0
Comment
Question by:Shathar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 15

Accepted Solution

by:
samri earned 250 total points
ID: 11920327
Hi Shatar,

It is customary for me to advise users to jump to Apache docs website on most issues.  Please take a look at VirtualHosting at http://httpd.apache.org/docs-2.0/vhosts/

Fisrst -- this is what I understand.  Your firewall (let say the public ip is 200.200.200.1 and dns name is www.domain1.com, www.domain2.com, www.domain3.com) is configured to forward it's port 80 to the apache1 (let say this guy is 192.168.1.100), Then this request is proxied to Apache2 (192.168.1.200), which has multiple Vhost.

If you had configure your Vhost to use Namebased virtualhosting (check apache docs above), the server would be looking at the Host: header in the HTTP request.  So if you remote user is typing http://www.domain1.com/ -> this request would be redirected to apache1.  Apache1 would have 2 (or whatever Vhost defined), each time the request is received the Host: header is examine, and the request will be served by the corresponding Virtualhost that has ServerName (or ServerAlias) matched the Host: header.

SO on apache1.  You would have a the default Vhost for the first website (default), and the other website, you need to specify the ServerName directive according to what you would expect users from the Internet would type.  All these name must be resolvable (DNS), and much point to your firewall.

The 2nd layer apache, would use the same concept.  If will examine the Host: header (if Vhost is used).  Remember that the request these apache received from apache1 will depend on what you use in

ProxyPass   / http://yourinternalipforapache1/
ProxyPassReverse / http://yourinternalipforapache1/

this name "yourinternalipforapache1" will be carried along in the request from apache1 to apache2.

confusef ?  if you could post the vhost config on both apache, maybe I could take a look.
0
 
LVL 15

Expert Comment

by:samri
ID: 12145530
my recommendation should be "plain vanilla" solution. I would think this should work, unless other members may want to  object.

rgds.
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

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…
Microsoft will be releasing the Windows 10 Creators Update in just a matter of weeks. Are you prepared? Follow these steps to ensure everything goes smoothly and you don't lose valuable data on your PC.
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…

705 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