httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Easton <matthewjeas...@gmail.com>
Subject Re: [users@httpd] How to serve pages from a hidden secondary server
Date Thu, 10 Jun 2010 14:40:33 GMT
On 10 Jun 2010, at 15:08, Tom Evans wrote:

> On Thu, Jun 10, 2010 at 2:56 PM, Matt Easton <matthewjeaston@gmail.com> wrote:
>> Hello there,
>> 
>> I've just joined this group as I'm trying more complicated things now than I've done
before in Apache! Please let me know if I'm not doing anything right. Thanks for your time.
>> 
>> I have two computers on a home network, let's call them server1 and server2. They
are both running an Apache server on port 80.
>> 
>> server1 hosts my main external web pages, so my router routes http://home.domain.com
to http://server1 (both on port 80)
>> server2 hosts some private pages, testing, sharing resources etc for my home network.
>> 
>> All is fine, except I now have some pages from server2 that I want to make available
outside of my home network. These are in a folder on the main site, i.e. http://server2/folder1
>> 
>> Ideally, I want this to be done in such a way that it is hidden from the user that
they are in fact accessing a different server.
>> Ideally I want them to go to http://home.domain.com/folder2 and actually be seeing
http://server2/folder1
>> 
>> I have tried doing this with mod_rewrite and failed. Is it possible to reference
a different server with mod_rewrite, or can this only be used for files on the same machine?
>> 
>> At the moment I have managed to serve the pages, by telling my router to forward
port 8081 to server2:80. Hence, if I go to http://home.domain.com:8081/folder1 then I get
the pages that I want. I have set up a Redirect directive on server1 so that http://home.domain.com/folder2
redirects to http://home.domain.com:8081/folder1, so I can get to the pages using the correct
URI, but it doesn't stay in the address bar - it is redirected to the other port.
>> 
>> It is further complicated because the data I want to serve includes streaming media,
and this doesn't seem to cope with the 8081 port.
>> 
>> I've been interested in the "mingle" emails today using proxies, but I can't get
this to work either.
>> 
>> Both machines are running Ubuntu.
>> server1: Ubuntu Karmic Koala 9.10 | Linux 2.6.31-22-generic | Apache/2.2.12 (Ubuntu)
>> server2: Ubuntu Lucid Lynx 10.04 LTS | Linux 2.6.32-22-generic | Apache/2.2.14 (Ubuntu)
>> 
>> Many thanks, and please let me know if I've missed out any vital information!
>> Cheers,
>> matt
> 
> Enable mod_proxy and mod_proxy_html, add this to the vhost you want
> /folder2 to appear on:
> 
> <Location /folder2/>
>  ProxyPass http://server2/folder1/
>  ProxyPassReverse http://server2/folder1/
> </Location>
> 
> Cheers
> 
> Tom

Thank you very much Tom! It was very simple, but I hadn't been using the proxy_http module.

It was slightly complicated when it came to authentication - the http://home.domain.com site
has digest authentication, and I assumed the location would inherit this, but it gave a permission
error. As soon as I entered the Auth* directives into the location section as well as its
parent, this has been fine.

Thanks,
matt
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message