Valentin V. Bartenev
June 18, 2014 03:16AM
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@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

lots of work in a location block...

GreenGecko June 17, 2014 08:18PM

Re: lots of work in a location block...

Valentin V. Bartenev June 18, 2014 03:16AM

Re: lots of work in a location block...

GreenGecko June 18, 2014 03:36AM

Re: lots of work in a location block...

Valentin V. Bartenev June 18, 2014 04:16AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 165
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready