?
Solved

Apache Mod_Proxy problem with virtual housts

Posted on 2004-08-27
5
Medium Priority
?
328 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 1000 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

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

By default, Carbonite Server Backup manages your encryption key for you using Advanced Encryption Standard (AES) 128-bit encryption. If you choose to manage your private encryption key, your backups will be encrypted using AES 256-bit encryption.
Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
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…
Suggested Courses

765 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