How to remove the "IF" in this fcgi config
Valentin V. Bartenev
vbart at nginx.com
Fri Feb 22 22:05:56 UTC 2013
On Saturday 23 February 2013 00:11:26 Francis Daly wrote:
> On Thu, Feb 21, 2013 at 07:08:56PM +0000, Ed W wrote:
> > On 21/02/2013 17:54, Igor Sysoev wrote:
> Hi there,
>
> > > location ~ ^(?<script_name>.+\.php)(?<path_info>/|$) {
> >
> > Can I ask you to confirm the correction of a typo in your answer. Do I
> >
> > want this:
> > ....(?<path_info>.*) {
>
> You probably want
>
> location ~ ^(?<script_name>.+\.php)(?<path_info>/.*|$) {
>
> because you want to match /X.php or /X.php/X but not /X.phpX.
>
IMHO,
location ~ ^(?<script_name>.+\.php)(?<path_info>/.*)?$ {
looks better.
% pcretest -b -d -m -s+
PCRE version 8.30 2012-02-04
re> !^(?<script_name>.+\.php)(?<path_info>/.*|$)!
Memory allocation (code space): 42
Memory allocation (JIT code): 1739
------------------------------------------------------------------
0 38 Bra
3 ^
4 15 CBra 1
9 Any+
11 .php
19 15 Ket
22 9 CBra 2
27 /
29 Any*
31 4 Alt
34 $
35 13 Ket
38 38 Ket
41 End
------------------------------------------------------------------
Capturing subpattern count = 2
Named capturing subpatterns:
path_info 2
script_name 1
Options: anchored
No first char
Need char = 'p'
Subject length lower bound = 5
No set of starting bytes
data>
re> !^(?<script_name>.+\.php)(?<path_info>/.*)?$!
Memory allocation (code space): 40
Memory allocation (JIT code): 1732
------------------------------------------------------------------
0 36 Bra
3 ^
4 15 CBra 1
9 Any+
11 .php
19 15 Ket
22 Brazero
23 9 CBra 2
28 /
30 Any*
32 9 Ket
35 $
36 36 Ket
39 End
------------------------------------------------------------------
Capturing subpattern count = 2
Named capturing subpatterns:
path_info 2
script_name 1
Options: anchored
No first char
Need char = 'p'
Subject length lower bound = 5
No set of starting bytes
wbr, Valentin V. Bartenev
--
http://nginx.com/support.html
http://nginx.org/en/donation.html
More information about the nginx
mailing list