Rewrite before regex location
B.R.
reallfqq-nginx at yahoo.fr
Fri May 6 11:51:46 UTC 2016
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 at 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 at daoine.org
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160506/fd09fd80/attachment.html>
More information about the nginx
mailing list