Solved

Apache Mod_Proxy problem with virtual housts

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

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

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

Create your own, high-performance VM backup appliance by installing NAKIVO Backup & Replication directly onto a Synology NAS!
The article will include the best Data Recovery Tools along with their Features, Capabilities, and their Download Links. Hope you’ll enjoy it and will choose the one as required by you.
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

679 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