Forum Moderators: phranque
I was wondering if any of you knows how to configure apache in such matter that it uses my another server running on www.somehost:8020 for images and such.
Basicly I have website with a lot of images and I would like thttpd to take care of serving static files so apache only handles php files.
I was looking into something like:
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /images http://www.somehost.com:8020/
ProxyPassReverse / http://www.somehost.com:8020/
But this would mean that apache still fetches the page from my thttpd server right? Meaning I am not reducting overhead, but maybe even increasing it because:
client requests bla.jpg->apache requests image from thttpd->thttpd serves it to apache->apache then serves it to client
If this is the case then I am not sure if this will reduce my server load at all. My another alternative I guess is mod_rewrite, but won't it send 302 header?
Sorry if this all sounds confusing, but I am not sure if I can explain it any better then this.
Hope you can help me or suggest some docs I could read, thank you.
P.S. I also don't mind if urls to images have port 8020 in them.
You don't actually need the ProxyPass stuff, since all you're doing is a reverse Proxy here -- See the mod_proxy docs.
If you wish to reverse proxy by filetype, then you'll probably want to use mod_rewrite to do it, since all of the native mod_proxy directives use URL prefix-matching only, as opposed to the suffix-matching you likely want. This is easily done using the [P] flag on a RewriteRule (Follow the link in the mod_proxy ProxyPassReverse documentation).
[added] No, a proxy pass-through in mod_rewrite is *not* a redirect. [/added]
Jim
[edited by: jdMorgan at 2:22 am (utc) on Dec. 28, 2006]