Casey Bralla on 6 Feb 2010 12:18:33 -0800


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

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


Jason, thanks for your comments.  I tried this:

<VirtualHost *>
    ServerName www.oldsite.org
    RewriteEngine On
    ProxyPreserveHost On
    # Send all inquiries for oldsite.com to newsite.com
    RewriteRule ^/(.*)$ http://www.newsite.com/$1 [P,L]
</VirtualHost>

To my thinking, this should have worked.

Unfortunately, I still get an "Internal Server Error" and the (to me) 
unfathomable error message in /var/log/apache2/error.log


I had put these items in my sites-available directory.   I also tried putting 
them in /etc/apache2/mods-available/proxy.conf

I moved the rewrite lines to there, and now I get a "Not Found" error, and the 
error logs complain about /htdocs not being found.   This seems better, but 
I'm still kinda lost.


Any other suggestions?




On Saturday 06 February 2010 2:41:41 pm Jason Stelzer wrote:
> 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
> 

-- 


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