Solved

Apache Mod_Proxy problem with virtual housts

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

A quick step-by-step overview of installing and configuring Carbonite Server Backup.
Microservice architecture adoption brings many advantages, but can add intricacy. Selecting the right orchestration tool is most important for business specific needs.
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…
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now