Welcome! Log In Create A New Profile

Advanced

Re: Rewrite before regex location

B.R.
May 06, 2016 07:54AM
As a sidenote, why using
location ~ ^/php-fpm/
and not
location /php-fpm/
?

Although being distant to your case (I see others are helping you nicely
:o) ), I can but particularly note & enjoy the use of a non-greedy modifier
in the regex part of fastcgi_split_path_info intended to result in
$fastcgi_script_name. That detail means a lot. Keep up the good work :o)
​​
---
*B. R.*

On Thu, May 5, 2016 at 6:44 PM, Francis Daly <francis@daoine.org> wrote:

> On Thu, May 05, 2016 at 05:13:29AM +0530, Joyce Babu wrote:
>
> Hi there,
>
> > Is it possible to do something like this?
> >
> > location /test/ {
> > rewrite "^/test/([a-z]+).php$" /php-fpm/test/test.php?q=$1 last;
> > }
> >
> > location ~ ^/php-fpm/ {
> > location ~ [^/]\.php(/|$) {
> > fastcgi_split_path_info ^/php-fpm(.+?\.php)(/.*)$;
> >
> > fastcgi_pass 127.0.0.1:9000;
> > fastcgi_index index.php;
> > include fastcgi_params;
> > }
> > }
> >
> >
> > What I have tried to do here is rewrite to add a special prefix
> (/php-fpm)
> > to the rewritten urls. and nest the php location block within it. Then
> use
> > fastcgi_split_path_info to create new $fastcgi_script_name without the
> > special prefix. I tried the above code, but it is not working.
> > fastcgi_split_path_info is not generating $fastcgi_script_name without
> the
> > /php-fpm prefix.
>
> That's because your fastcgi_split_path_info pattern does not match -
> .php is not followed by / in your rewritten url.
>
> Because of the location{} you are in, it is probably simplest to just
> replace the second capture part of that pattern with (.*)$.
>
> Cheers,
>
> f
> --
> Francis Daly francis@daoine.org
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Rewrite before regex location

Joyce Babu May 04, 2016 05:28PM

Re: Rewrite before regex location

Francis Daly May 04, 2016 06:02PM

Re: Rewrite before regex location

Joyce Babu May 04, 2016 06:54PM

Re: Rewrite before regex location

Francis Daly May 04, 2016 07:16PM

Re: Rewrite before regex location

Joyce Babu May 04, 2016 07:46PM

Re: Rewrite before regex location

Anoop Alias May 04, 2016 10:24PM

Re: Rewrite before regex location

Joyce Babu May 06, 2016 04:18PM

Re: Rewrite before regex location

Francis Daly May 05, 2016 12:46PM

Re: Rewrite before regex location

B.R. May 06, 2016 07:54AM

Re: Rewrite before regex location

Joyce Babu May 06, 2016 04:38PM

Re: Rewrite before regex location

Joyce Babu May 06, 2016 06:26PM

Re: Rewrite before regex location

Joyce Babu May 06, 2016 06:30PM

Re: Rewrite before regex location

Robert Paprocki May 06, 2016 06:30PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 96
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