lots of work in a location block...

Steve Holdoway steve at greengecko.co.nz
Wed Jun 18 07:35:02 UTC 2014


That's a red herring... cut/paste error. The rewrite is being processed,
the result isn't being passed to the proxy server.

On Wed, 2014-06-18 at 11:14 +0400, Valentin V. Bartenev wrote:
> On Wednesday 18 June 2014 12:15:29 Steve Holdoway wrote:
> > Hi Folks,
> > 
> > I'm trying to integrate a python backend into a pre-existing php
> > website, and am having problems doing this as I need to rewrite the url
> > at the same time... eg: this is what isn't working.
> > 
> > 	location = /example {
> 
> The only request, that will be handled by your location with "=" modifier
> is "/example", even "/example/" isn't fit.
> 
> > 		rewrite /example/(.*) /$1 break;
> > 
> > 		root /www/example;
> > 		
> > 		include proxy_params;
> > 		proxy_pass http://python;
> > 
> > 		#break;
> > 	}
> > ( stripped to bare essentials )
> > 
> > So it's
> >  - strip off the /example prefix
> >  - set the new root ( the php site sets is outside any location block )
> >  - pass stripped request to the python backend.
> [..]
> 
> Please note, that the "root" directive is almost meaningless in location
> with "proxy_pass".
> 
> And you don't need "rewrite".
> 
> Something like that should work:
> 
>   location /example/ {
>       include proxy_params;
>       proxy_pass http://python/;
>   }
> 
> Please also check the docs:
> 
> http://nginx.org/r/proxy_pass
> http://nginx.org/r/location
> 
>   wbr, Valentin V. Bartenev
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx




More information about the nginx mailing list