LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-03-2010, 03:31 PM   #1
dexznrl
Member
 
Registered: Jul 2009
Posts: 36

Rep: Reputation: 0
Apache mod_proxy and virtualhost


So I have figured out how to use virtualhost, proxypass and proxypassreverse. So far, so good.

The problem I'm experiencing is this:

I have a reverse proxy server running apache (123.123.123.123)

Behind this proxy server I have a http server running apache (124.124.124.124).
This http server has multiple sites (virtualhost), it's only reachable via the proxy server.

If i run a nslookup on www.somedomain.com I get 123.123.123.123 (Not really but you understand what I mean)

I put my proxy to have the IP 123.123.123.123, so far so good. The requests come in to the proxy server.

I want my http server to be named 124.124.124.124.
In the http server I wish to set up my virtualhosts like this:
(simplified but you get it, right?)

<VirtualHost 124.124.124.124>
ServerName www.somedomain.com
Documentroot /home/somedomain.com
</VirtualHost>

How do I get my proxy to grab the data from the http server?

If I do like this I will only make another request to my proxy server.

<VirtualHost www.somedomain.com>
ServerName www.somedomain.com
PROXYRequests Off
ProxyPass / http://www.somedomain.com/
ProxyPassReverse / http://www.somedomain.com/
</VirtualHost>

If I do like this, only the first page in the httpd.conf in my http server will work.

<VirtualHost www.somedomain.com>
ServerName www.somedomain.com
PROXYRequests Off
ProxyPass / http://124.124.124.124/
ProxyPassReverse / http://124.124.124.124/
</VirtualHost>

So how do I do it?

Do I need to setup a different DNS server for the proxy server? I would hate that. Perhaps use hosts-file in proxy. Or maybe I can use sub-domains?

All of the above are solutions that I would really hate to use, so is there a "best-practise" here?
 
Old 11-03-2010, 05:58 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

You should setup the vhosts on the reverse proxy and use something like the following for each one of them:
Code:
<VirtualHost 123.123.123.123>
ServerName www.somedomain.com
ProxyRequests Off
ProxyPass / http://124.124.124.124/somedomain.com/
ProxyPassReverse / http://124.124.124.124/somedomain.com/
</VirtualHost>
I assume that the DocumentRoot of each vhost in 124.124.124.124 is a subdirectory (like somedomain.com in the example above) under the DocumentRoot of the _default_ server.

Regards
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache mod_proxy log mahmoud Linux - Software 1 06-07-2010 01:54 AM
about the URL when using Apache mod_proxy myhnet Linux - Newbie 0 06-24-2008 07:08 AM
Apache + Mod_proxy ProxyPass paul_mat Linux - Networking 2 04-14-2006 08:57 PM
Apache 1.3 mod_proxy no cache mago Linux - Software 0 04-07-2006 12:39 PM
Webmin Through Apache using mod_proxy... ech310n Linux - General 0 01-28-2004 04:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration