Jason Stelzer on 6 Feb 2010 11:41:47 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Apache Mod Proxy & Mod Rewrite Questions


back when I was using mongrel clusters for my rails apps, I would set
up something along the lines of this:

#    ProxyRequests Off
#    ProxyPreserveHost On
#    RewriteEngine On
#    <proxy *>
#      order deny,allow
#      allow from all
#    </proxy>
#    RewriteRule ^/(.*)$ balancer://myapp1/$1 [P,L]
#
#   <Proxy balancer://myapp1>
#       BalancerMember http://127.0.0.1:3000
#       BalancerMember http://127.0.0.1:3001
#       BalancerMember http://127.0.0.1:3002
#       BalancerMember http://127.0.0.1:3003
#       BalancerMember http://127.0.0.1:3004
#   </Proxy>

Just not that you define a rewrite rule for everything under the web
root. Then you define what to write it to. I was using balancers
because mongrel is a single ruby process per port. So i was round
robin load balancing.

Note that blancer://myapp1 is defined, and the members are named in
the definition.

For your purposes you could probably just use
http://www.newsite.com/$1 [P,L] and it'll just go.


On Sat, Feb 6, 2010 at 2:00 PM, Casey Bralla <MailList@nerdworld.org> wrote:
> I'm having some difficulty with apache2 and and mod rewrite and mod proxy on
> my Debian system.   Lee Marzke (Thanks Lee!) was able to help me before, but
> I'm still not quite where I want to be.
>
> Here's what I'm trying to do:
>
> I want to send all http traffic for a specific virtual domain to a separate
> server.  This __almost__ works.
>
>
> Here's what I've done so far:
>
> in the /etc/apache2/sites-available/newsite file, I've added this:
>
> <VirtualHost *>
>    ServerName www.newsite.org
>    RewriteEngine On
>    RewriteRule ^/(.*)$ http://www.newsite.com/$1 [R,L]
> </VirtualHost>
>
>
>
> This works fine.  When I enter http://www.oldsite.com into my browser, I am
> instantly taken to www.newsite.com.   The only problem is that on my browser,
> the address shows the URL for newsite.com instead of the oldsite.com.   (I
> don't want to user to see that I've moved the server.)
>
>
>
> I've also tried to use the proxy module, by doing this:
>
> <VirtualHost *>
>    ServerName www.newsite.org
>    RewriteEngine On
>    RewriteRule ^/(.*)$ http://www.newsite.com/$1 [P]
>    ProxyPassReverse / http://www.newsite.com/
> </VirtualHost>
>
> But this gives me an "Internal Server Error" and this shows up in the apache
> error log:
> [warn] proxy: No protocol handler was valid for the URL /. If you are using a
> DSO version of mod_proxy, make sure the proxy submodules are included in the
> configuration using LoadModule.
>
>
>
> Can somebody suggest what I'm doing wrong and point me in the right direction?
> TIA!
>
>
> --
>
>
> Casey Bralla
>
> Chief Nerd in Residence
> The NerdWorld Organisation
>
> http://www.NerdWorld.org
> ___________________________________________________________________________
> Philadelphia Linux Users Group         --        http://www.phillylinux.org
> Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
> General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug
>



-- 
J.
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug