LinuxQuestions.org
Help answer threads with 0 replies.
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 06-13-2008, 07:02 AM   #1
t0bias
Member
 
Registered: Aug 2005
Distribution: Fedora 13, RHEL 5.3, Ubuntu 10.04, Debian Lenny
Posts: 128

Rep: Reputation: 16
proxying a server in a subdirectory?


hi,

is it possible to "show up" a whole webserver in a subdirectory of another server with apache?
e.g. server http://foo.com --> http://bar.com/foo

thanks,

toby
 
Old 06-13-2008, 10:25 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
for simple implementations, yes. check out mod_proxy and the proxypass and proxypassreverse directives.

Last edited by acid_kewpie; 06-13-2008 at 10:41 AM.
 
Old 06-13-2008, 10:38 AM   #3
t0bias
Member
 
Registered: Aug 2005
Distribution: Fedora 13, RHEL 5.3, Ubuntu 10.04, Debian Lenny
Posts: 128

Original Poster
Rep: Reputation: 16
I tried this:

on the server www.bar.com
Code:
ProxyPass /foo http://www.foo.com
ProxyPassReverse /foo http://www.foo.com
but calling http://www.bar.com/foo results in a 404 not found message.
what did i do wrong?

thanks.

Last edited by t0bias; 06-13-2008 at 10:39 AM.
 
Old 06-13-2008, 10:41 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
can you show us the full config please? I assume you reloaded the apache config after this?
 
Old 06-13-2008, 10:49 AM   #5
t0bias
Member
 
Registered: Aug 2005
Distribution: Fedora 13, RHEL 5.3, Ubuntu 10.04, Debian Lenny
Posts: 128

Original Poster
Rep: Reputation: 16
yes, i did, but no success....

--> apache 1.3.34

Code:
[...]
<IfModule mod_proxy.c>

    <Directory "/proxy">
     ProxyPass /proxy http://blablabla
     ProxyPassReverse /proxy http://blablabla 
 
     Order deny,allow
     Deny from all
     Allow from 10.0.0.0/24
     Allow from 172.12.1.92
    </Directory>
</IfModule>
[...]
 
Old 06-13-2008, 10:56 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
the directory directive is a local unix path, i.e. a directory called "proxy" in your root partition. Generally mod_proxy directives go in ta virtualhost or default host definition.
 
Old 06-13-2008, 10:59 AM   #7
t0bias
Member
 
Registered: Aug 2005
Distribution: Fedora 13, RHEL 5.3, Ubuntu 10.04, Debian Lenny
Posts: 128

Original Poster
Rep: Reputation: 16
oh i see.. so what if i used the "location" directive instead?
 
Old 06-13-2008, 04:02 PM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
you wouldn't use any directive. just add it after your ServerName or ServerAlias directive for the host / virtualhost you want this to work under.
 
Old 06-14-2008, 12:26 AM   #9
t0bias
Member
 
Registered: Aug 2005
Distribution: Fedora 13, RHEL 5.3, Ubuntu 10.04, Debian Lenny
Posts: 128

Original Poster
Rep: Reputation: 16
It now looks like this:

Code:
[...]
<IfModule mod_proxy.c>

     ProxyPass /proxy http://blablabla
     ProxyPassReverse /proxy http://blablabla 
 
</IfModule>
[...]
but still:

The requested URL /proxy was not found on this server.

I need to place the ProxyPass and ProxyPassReverse in the "IfModule"-directive, outside it gives me an error and I cannot load the module separately as it seems mod_proxy is compiled into the apache-binary in the debian package?
 
Old 06-14-2008, 01:27 AM   #10
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
Well think about it then... if it doesn't work if it's outside then clearly that MUST mean that mod proxy is not built / enabled in the first place, as all you're doing is a condidtional check on mod_proxy being available - i.e. it's *not* available therefore the commands are not run. Again, those directives should be in the virtualhost definitions or equivalent.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
make "localhost" point to a subdirectory of Apache server oudent Linux - Networking 2 07-21-2005 07:37 PM
SMTP Proxying for AUTH? Matir Linux - Software 0 02-17-2005 12:41 PM
mount subdirectory from another Linux server kiwi8 Linux - Newbie 6 07-18-2004 06:33 PM
proxying a proxy jobinmathews Linux - Networking 3 07-14-2003 05:13 AM
Proxying question snowdog12 Linux - Networking 0 02-10-2003 02:01 PM

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

All times are GMT -5. The time now is 04:51 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration