LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   proxying a server in a subdirectory? (https://www.linuxquestions.org/questions/linux-server-73/proxying-a-server-in-a-subdirectory-649029/)

t0bias 06-13-2008 07:02 AM

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

acid_kewpie 06-13-2008 10:25 AM

for simple implementations, yes. check out mod_proxy and the proxypass and proxypassreverse directives.

t0bias 06-13-2008 10:38 AM

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.

acid_kewpie 06-13-2008 10:41 AM

can you show us the full config please? I assume you reloaded the apache config after this?

t0bias 06-13-2008 10:49 AM

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>
[...]


acid_kewpie 06-13-2008 10:56 AM

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.

t0bias 06-13-2008 10:59 AM

oh i see.. so what if i used the "location" directive instead?

acid_kewpie 06-13-2008 04:02 PM

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.

t0bias 06-14-2008 12:26 AM

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?

acid_kewpie 06-14-2008 01:27 AM

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.


All times are GMT -5. The time now is 09:41 AM.