<div dir="ltr"><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">As a sidenote, why using<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)"><span style="font-family:monospace,monospace">location ~ ^/php-fpm/</span><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">and not<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)"><span style="font-family:monospace,monospace">location /php-fpm/</span><br>?<br><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">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 <span style="font-family:monospace,monospace">fastcgi_split_path_info</span> intended to result in <span style="font-family:monospace,monospace">$fastcgi_script_name</span>. That detail means a lot. Keep up the good work :o)<br></div><div class="gmail_extra"><div><div class="gmail_signature"><font size="1"><span style="color:rgb(102,102,102)"><div class="gmail_default" style="font-size:small;color:rgb(51,51,153);display:inline"></div>---<br></span><b><span style="color:rgb(102,102,102)">B. R.</span></b><span style="color:rgb(102,102,102)"></span></font></div></div>
<br><div class="gmail_quote">On Thu, May 5, 2016 at 6:44 PM, Francis Daly <span dir="ltr"><<a href="mailto:francis@daoine.org" target="_blank">francis@daoine.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, May 05, 2016 at 05:13:29AM +0530, Joyce Babu wrote:<br>
<br>
Hi there,<br>
<span class=""><br>
> Is it possible to do something like this?<br>
><br>
> location /test/ {<br>
> rewrite "^/test/([a-z]+).php$" /php-fpm/test/test.php?q=$1 last;<br>
> }<br>
><br>
> location ~ ^/php-fpm/ {<br>
> location ~ [^/]\.php(/|$) {<br>
> fastcgi_split_path_info ^/php-fpm(.+?\.php)(/.*)$;<br>
><br>
> fastcgi_pass <a href="http://127.0.0.1:9000" rel="noreferrer" target="_blank">127.0.0.1:9000</a>;<br>
> fastcgi_index index.php;<br>
> include fastcgi_params;<br>
> }<br>
> }<br>
><br>
><br>
> What I have tried to do here is rewrite to add a special prefix (/php-fpm)<br>
> to the rewritten urls. and nest the php location block within it. Then use<br>
> fastcgi_split_path_info to create new $fastcgi_script_name without the<br>
> special prefix. I tried the above code, but it is not working.<br>
> fastcgi_split_path_info is not generating $fastcgi_script_name without the<br>
> /php-fpm prefix.<br>
<br>
</span>That's because your fastcgi_split_path_info pattern does not match -<br>
.php is not followed by / in your rewritten url.<br>
<br>
Because of the location{} you are in, it is probably simplest to just<br>
replace the second capture part of that pattern with (.*)$.<br>
<br>
Cheers,<br>
<div class="HOEnZb"><div class="h5"><br>
f<br>
--<br>
Francis Daly <a href="mailto:francis@daoine.org">francis@daoine.org</a><br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</div></div></blockquote></div><br></div></div>