Solved

Apache Mod_Proxy problem with virtual housts

Posted on 2004-08-27
5
324 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
  • 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
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 will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
This tutorial will walk an individual through the process of installing of Data Protection Manager on a server running Windows Server 2012 R2, including the prerequisites. Microsoft .Net 3.5 is required. To install this feature, go to Server Manager…

861 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