Are these rules ok?


#1

I’m trying to setup my first site, which uses wordpress, photopost
classifieds, vbulletin and gossamer threads (CGI Perl based) software -
along with some fairly simple posts.

The site is being migrated from apache (frontend) + lightttpd (static)
to a nginx + fastcgi. I’m focused on migrating the PHP part first, as we
can always proxy the CGI requests to Apache.

My nginx.conf looks like this (based on various bits and pieces found on
google and mailing lists).

My questions are

  1. Am I missing something obvious?
  2. Why cant I get the Wordpress 404 to work correctly?
  3. We need to exclude a couple of countries due to various illegal spam
    issues. Is this http://wiki.codemongers.com/NginxHttpGeoModule the best
    way to do it?

Thanks in advance from someone who is VERY new to Nginx.

Regards,
Shri


server {

    listen  80;
    server_name domain.com www.domain.com;

    root /site/domain/dec08;

#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule . /index.php [L]

    error_page 404 =404 /index.php;

    index index.php index.html index.htm;

    location ~* \.(jpg|jpeg|gif|css|png|js|ico)$ {
            access_log      off;
            expires         30d;
            break;
    }

    ### Proxy CGI to Apache for now
    location ^~ /scripts/ {
          proxy_pass http://cgiserver;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header Host $host;
          proxy_set_header X-Forwarded-For 

$proxy_add_x_forwarded_for;
}

    location ^~ /resources/Detailed/ {
          proxy_pass http://cgiserver;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header Host $host;
          proxy_set_header X-Forwarded-For 

$proxy_add_x_forwarded_for;
}

Deal with VBSEO Rules

#RewriteRule ^((urllist|sitemap_)..(xml|txt)(.gz)?)$
vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
#RewriteCond %{REQUEST_URI} !(admincp/|modcp/|cron)
#RewriteRule ^((archive/)?(.
.php(/.*)?)?)$ vbseo.php [L,QSA]
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_FILENAME}
!^(admincp|modcp|clientscript|cpstyles|images)/
#RewriteRule ^(.+)$ vbseo.php [L,QSA]

    location /forum/ {

    rewrite ^/forum/getnew.html$ /forum/search.php?do=getnew last;
    rewrite ^/forum/getnew([0-9]+).html$ 

/forum/search.php?do=getnew&f=$1 last;
rewrite ^/forum/((urllist|sitemap_).*.(xml|txt)(.gz)?)$
/forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;
rewrite ^/forum/unanswered.html$
/forum/search.php?do=process&replyless=1&replylimit=0&dontcache=1 last;
rewrite ^/forum/unanswered([0-9]+).html$
/forum/search.php?do=process&replyless=1&replylimit=0&dontcache=1&forumchoice=$1&childforums=1
last;

    if ($request_filename ~ "\.php$" ) {
            rewrite ^/forum/(.*)$ /forum/vbseo.php last;
    }

    if (!-e $request_filename) {
            rewrite ^/forum/(.*)$ /forum/vbseo.php last;
    }
    }

    location ~ \.php {

            set $script $uri;
            set $path_info "";

#need this bit to work for classifieds friendly urls which need
path_info to be set

            if ($uri ~ "^(.+\.php)(/.+)") {
                    set $script $1;
                    set $path_info $2;
            }

        fastcgi_pass   unix:/var/tmp/lighttpd/fastcgi-php.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /site/expat/oct08$script;
        fastcgi_param  PATH_INFO    $path_info;
        include        fastcgi_params;
    }

    location ~ /\.ht {
        deny  all;
    }
}

}


#2

Igor,

Thank you very much for taking the time to answer.

The setup is as follows.

/ <-- Wordpress is installed and shows the main page and content
/forum/ <-- vBulletin
/classifieds/ <-- Photopost
/scripts/ <-- perl CGI scripts
/resources/ <-- files built by the Gossamer Links CGI package
/resources/Detailed/ <-- More files built by the CGI package

I am using 0.7.24 which is the latest -devel branch I found in the
Freebsd
ports.

Should I try a newer one?

Thanks once again for replying. Have fun on your vacation!

Regards,
Shri

On Wed, 24 Dec 2008 20:05:48 +0300, Igor S. removed_email_address@domain.invalid
wrote:

My nginx.conf looks like this (based on various bits and pieces found on
google and mailing lists).

My questions are

  1. Am I missing something obvious?
  2. Why cant I get the Wordpress 404 to work correctly?
  3. We need to exclude a couple of countries due to various illegal spam
    issues. Is this http://wiki.codemongers.com/NginxHttpGeoModule the best
    way
    fastcgi_param  SCRIPT_FILENAME  /path/to/index.php;

    ### Proxy CGI to Apache for now
          proxy_set_header X-Real-IP $remote_addr;

#RewriteCond %{REQUEST_FILENAME} !-f
rewrite ^/forum/((urllist|sitemap_).*.(xml|txt)(.gz)?)$
/forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;
rewrite ^/forum/unanswered.html$
/forum/search.php?do=process&replyless=1&replylimit=0&dontcache=1 last;
rewrite ^/forum/unanswered([0-9]+).html$

/forum/search.php?do=process&replyless=1&replylimit=0&dontcache=1&forumchoice=$1&childforums=1


#3

On Thu, Dec 25, 2008 at 08:09:45AM +0800, removed_email_address@domain.invalid wrote:

/resources/ <-- files built by the Gossamer Links CGI package
/resources/Detailed/ <-- More files built by the CGI package

I am using 0.7.24 which is the latest -devel branch I found in the Freebsd
ports.

Should I try a newer one?

You may use either 0.7.24 (but without handy try_files) or the newest
0.7.30.

You may start from Wordpress configuration, and temporarily passing
other location to old servers. I think you do need to set up PATH_INFO.

location / {
    try_files      $uri  @wordpress;
}

location ~ \.php$ {
    try_files      $uri  @wordpress;

    fastcgi_pass   unix:/var/tmp/lighttpd/fastcgi-php.sock;
    fastcgi_param  SCRIPT_FILENAME 

/site/expat/oct08$fastcgi_script_name;
include fastcgi_params;
}

location @wordpress {
    fastcgi_pass   unix:/var/tmp/lighttpd/fastcgi-php.sock;
    fastcgi_param  SCRIPT_FILENAME  /site/expat/oct08/index.php;
    include        fastcgi_params;
}

# passing to all servers

location ^~ /forum/
    proxy_pass    ...;
}

location ^~ /classifieds/
    proxy_pass    ...;
}

location ^~ /scripts/
    proxy_pass    ...;
}

location ^~ /resources/
    proxy_pass    ...;
}

Then you may try to setup vBulletin configuration:

location = /forum/getnew.html {
    rewrite ^/forum/getnew.html$ /forum/search.php?do=getnew last;

    # or you may right now set FastCGI paramters and pass the 

request
# to FastCGI, but you should remove QUERY_STRING from
fastcgi_params0

    #fastcgi_pass   unix:/var/tmp/lighttpd/fastcgi-php.sock;
    #fastcgi_param  SCRIPT_FILENAME 

/site/expat/oct08/forum/search.php;
#fastcgi_param QUERY_STRING do=getnew;
#include fastcgi_params0;
}

location /forum/ {

    # this is handled above as exact match
    #rewrite ^/forum/getnew.html$ /forum/search.php?do=getnew last;

    rewrite ^/forum/getnew([0-9]+).html$
             /forum/search.php?do=getnew&f=$1 last;

    rewrite ^/forum/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$
             /forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 

last;

    rewrite ^/forum/unanswered.html$
             /forum/search.php?do=process&replyless=1&replylimit=0&dontcache=1 

last;
rewrite ^/forum/unanswered([0-9]+).html$
/forum/search.php?do=process&replyless=1&replylimit=0&dontcache=1&forumchoice=$1&childforums=1
last;

    try_files      $uri  @vbulletin;
}

location ~ ^/forum/.+\.php$ {
    fastcgi_pass   unix:/var/tmp/lighttpd/fastcgi-php.sock;
    fastcgi_param  SCRIPT_FILENAME 

/site/expat/oct08/forum/vbseo.php;
include fastcgi_params;
}

location @vbulletin {
    fastcgi_pass   unix:/var/tmp/lighttpd/fastcgi-php.sock;
    fastcgi_param  SCRIPT_FILENAME 

/site/expat/oct08/forum/vbseo.php;
include fastcgi_params;
}

It’s probably time to implement location captures in nginx:

location ~ /forum/getnew([0-9]+).html {
    fastcgi_pass   unix:/var/tmp/lighttpd/fastcgi-php.sock;
    fastcgi_param  SCRIPT_FILENAME 

/site/expat/oct08/forum/search.php;
fastcgi_param QUERY_STRING do=getnew&f=$1;
include fastcgi_params0;
}

I will do this after vacation.


#4

Igor,

Here’s what I have and it seems to work. Not sure if its correct. Any
comments?

Also, any ideas on how best to handle these rules?

RewriteRule ^jobs/category/(.+)$ /jobs/index.php?cat_name=$1 [NC,L]
RewriteRule ^jobs/job/(.+)$ /jobs/index.php?post_permalink=1&post_id=$1
[NC,L]
RewriteRule ^jobs/profile/(.+)$ /jobs/index.php?show_emp=$1 [NC,L]
RewriteCond %{QUERY_STRING} .+
RewriteRule ^jobs/page(.+)
/jobs/index.php?%{QUERY_STRING}&job_page_link=$1
[NC,L]
RewriteRule ^jobs/page(.+) /jobs/index.php?job_page_link=$1 [NC,L]

    root /site/expat/oct08;

    index index.php index.html index.htm;

    location / {
    try_files      $uri  @wordpress;
    }

location ~ \.php$ {
    try_files      $uri  @wordpress;

            set $script $uri;
            set $path_info "";

            if ($uri ~ "^(.+\.php)(/.+)") {
                    set $script $1;
                    set $path_info $2;
            }

   fastcgi_param  SCRIPT_FILENAME

/site/expat/oct08$fastcgi_script_name;
fastcgi_pass unix:/var/tmp/lighttpd/fastcgi-php.sock;
fastcgi_index index.php;
fastcgi_param PATH_INFO $path_info;
include fastcgi_params;
}

location @wordpress {

    fastcgi_param  SCRIPT_FILENAME  /site/expat/oct08/index.php;
        fastcgi_pass   unix:/var/tmp/lighttpd/fastcgi-php.sock;
        fastcgi_index  index.php;
        fastcgi_param  PATH_INFO    $path_info;
        include        fastcgi_params;

}

    location ~* \.(jpg|jpeg|gif|css|png|js|ico)$ {
            access_log      off;
            expires         30d;
            break;
    }

    location ^~ /scripts/ {
          proxy_pass http://cgiserver;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header Host $host;
          proxy_set_header X-Forwarded-For 

$proxy_add_x_forwarded_for;
}

    location ^~ /resources/Detailed/ {
          proxy_pass http://cgiserver;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header Host $host;
          proxy_set_header X-Forwarded-For 

$proxy_add_x_forwarded_for;
}

location /forum/ {

    # this is handled above as exact match
    rewrite ^/forum/getnew.html$ /forum/search.php?do=getnew last;

    rewrite ^/forum/getnew([0-9]+).html$

/forum/search.php?do=getnew&f=$1 last;

    rewrite ^/forum/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$

/forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;

    rewrite ^/forum/unanswered.html$

/forum/search.php?do=process&replyless=1&replylimit=0&dontcache=1 last;

    rewrite ^/forum/unanswered([0-9]+).html$

/forum/search.php?do=process&replyless=1&replylimit=0&dontcache=1&forumchoice=$1&childforums=1
last;

    try_files      $uri  @vbulletin;
}

location ~ ^/forum/.+\.php$ {
    fastcgi_pass   unix:/var/tmp/lighttpd/fastcgi-php.sock;
    fastcgi_param  SCRIPT_FILENAME 

/site/expat/oct08/forum/vbseo.php;
include fastcgi_params;
}
location @vbulletin {
fastcgi_pass unix:/var/tmp/lighttpd/fastcgi-php.sock;
fastcgi_param SCRIPT_FILENAME
/site/expat/oct08/forum/vbseo.php;
include fastcgi_params;
}

    location /classifieds/ {
            try_files $uri @classifieds;
    }

    location @classifieds {

        fastcgi_param  SCRIPT_FILENAME

/site/expat/oct08$fastcgi_script_name;
fastcgi_pass unix:/var/tmp/lighttpd/fastcgi-php.sock;
fastcgi_index index.php;
fastcgi_param PATH_INFO $path_info;
include fastcgi_params;

    }

    location ~ /\.ht {
        deny  all;
    }

----- Original Message -----
From: “Igor S.” removed_email_address@domain.invalid
To: removed_email_address@domain.invalid
Sent: Thursday, December 25, 2008 3:50 PM
Subject: Re: Are these rules ok?


#5

On Wed, Dec 24, 2008 at 11:32:46PM +0800, Shri @ GeoExpat.Com wrote:

  1. We need to exclude a couple of countries due to various illegal spam issues. Is this http://wiki.codemongers.com/NginxHttpGeoModule the best way to do it?

Thanks in advance from someone who is VERY new to Nginx.

How do you separate wordpress, photopost classifieds, vbulletin, and
gossamer
on the site ? I see vbulletin’s /forums, and some /scripts/
and /resources/Detailed/ only.

BTW, note that nginx does not support CGI.

If you use 0.6.34, then it’s better to apply patch
http://sysoev.ru/nginx/patch.try_files.0.6.34
and use new “try_files” directive.
In 0.7.30 already has this functionality.

Then you can handle Wordpress using following configuration:

location / {
    try_files      $uri  @wordpress;
}

location ~ \.php$ {
    try_files      $uri  @wordpress;

    fastcgi_param  SCRIPT_FILENAME  /path/to$fastcgi_script_name;
    ... other fastcgi_param
}

location @wordpress {
    fastcgi_pass   ...;

    fastcgi_param  SCRIPT_FILENAME  /path/to/index.php;
    ... other fastcgi_param
}

This is replacement of these Apache rules:

#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule . /index.php [L]


#6

On Thu, Dec 25, 2008 at 11:02:46PM +0800, Shri @ DevLib.Org wrote:

RewriteRule ^jobs/page(.+) /jobs/index.php?%{QUERY_STRING}&job_page_link=$1
[NC,L]
RewriteRule ^jobs/page(.+) /jobs/index.php?job_page_link=$1 [NC,L]

Does jobs/category/(.+)$ mean “/job/category/…” or
“…/job/category/…” ?

       fastcgi_pass   unix:/var/tmp/lighttpd/fastcgi-php.sock;
       fastcgi_index  index.php;
       fastcgi_param  PATH_INFO    $path_info;
       include        fastcgi_params;

}

Are you sure that you need PATH_INFO ?

BTW, “fastcgi_index index.php” is useless here. It’s required to map
“/some/uri/” to “path/to/index.php”. As fastcgi_index inside
“location ~ .php$”, then “/some/uri” simply will never handled in this
location.

   location ~* \.(jpg|jpeg|gif|css|png|js|ico)$ {
   }
   # this is handled above as exact match

Remove this comment, as it was relelated to

location = /forum/getnew.html {
rewrite ^/forum/getnew.html$ /forum/search.php?do=getnew last;
}


#7

After a bit of playing around. I think I have a config that works. (Not
sure
I understand some bits, but it does seem to work across all the various
sections of the site).

I now have to port over dozens of rewrites I assume the best way to do
this
is to put them in a seperate file and include them under “location /”
block?

E.g: #RewriteRule ^hong-kong/(.*)$ http://www.geoexpat.com/resources/
[R=permanent,L]

Once that is done, need to figure out the

Thanks!

Shri

server {

    listen  80;
    server_name geoexpat.com www.geoexpat.com;

    root /site/expat/oct08;

    index index.php index.html index.htm;

    location / {
            try_files      $uri  @wordpress;
    }


    location ~ \.php$ {
            try_files      $uri  @wordpress;

            set $script $uri;
            set $path_info "";

            if ($uri ~ "^(.+\.php)(/.+)") {
                    set $script $1;
                    set $path_info $2;
            }

            fastcgi_param  SCRIPT_FILENAME

/site/expat/oct08$fastcgi_script_name;
fastcgi_pass unix:/var/tmp/lighttpd/fastcgi-php.sock;
# fastcgi_param PATH_INFO $path_info;
include fastcgi_params;
}

    location @wordpress {
            fastcgi_param  SCRIPT_FILENAME 

/site/expat/oct08/index.php;
fastcgi_pass unix:/var/tmp/lighttpd/fastcgi-php.sock;
fastcgi_param PATH_INFO $path_info;
include fastcgi_params;
}

    location ~* \.(jpg|jpeg|gif|css|png|js|ico)$ {
            access_log      off;
            expires         30d;
            break;
    }

    location /classifieds/ {
            try_files      $uri  @wordpress;

            set $script $uri;
            set $path_info "";

            if ($uri ~ "^(.+\.php)(/.+)") {
                    set $script $1;
                    set $path_info $2;
            }

            fastcgi_param  SCRIPT_FILENAME

/site/expat/oct08$fastcgi_script_name;
fastcgi_pass unix:/var/tmp/lighttpd/fastcgi-php.sock;
fastcgi_param PATH_INFO $path_info;
include fastcgi_params;
}

    location ^~ /scripts/ {
          proxy_pass http://cgiserver;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header Host $host;
          proxy_set_header X-Forwarded-For 

$proxy_add_x_forwarded_for;
}

    location ^~ /resources/Detailed/ {
          proxy_pass http://cgiserver;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header Host $host;
          proxy_set_header X-Forwarded-For 

$proxy_add_x_forwarded_for;
}

    location /forum/ {
            rewrite ^/forum/getnew.html$ /forum/search.php?do=getnew

last;
rewrite ^/forum/getnew([0-9]+).html$
/forum/search.php?do=getnew&f=$1 last;
rewrite
^/forum/((urllist|sitemap_).*.(xml|txt)(.gz)?)$
/forum/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;
rewrite ^/forum/unanswered.html$
/forum/search.php?do=process&replyless=1&replylimit=0&dontcache=1 last;
rewrite ^/forum/unanswered([0-9]+).html$
/forum/search.php?do=process&replyless=1&replylimit=0&dontcache=1&forumchoice=$1&childforums=1
last;
try_files $uri @vbulletin;
}

    location ~ ^/forum/.+\.php$ {
            fastcgi_pass   unix:/var/tmp/lighttpd/fastcgi-php.sock;
            fastcgi_param  SCRIPT_FILENAME

/site/expat/oct08/forum/vbseo.php;
include fastcgi_params;
}

    location @vbulletin {
            fastcgi_pass   unix:/var/tmp/lighttpd/fastcgi-php.sock;
            fastcgi_param  SCRIPT_FILENAME

/site/expat/oct08/forum/vbseo.php;
include fastcgi_params;
}

    location /jobs/ {
            rewrite ^/jobs/category/(.+)$ 

/jobs/index.php?cat_name=$1
last;
rewrite ^/jobs/job/(.+)$
/jobs/index.php?post_permalink=1&post_id=$1 last;
rewrite ^/jobs/profile/(.+)$ /jobs/index.php?show_emp=$1
last;
rewrite ^/jobs/page(.+)$
/jobs/index.php?job_page_link=$1
last;
}

    location ~ /\.ht {
        deny  all;
    }
}

#8

Igor,

Photopost Classifieds, the package that I use for the classifieds needs
Pathinfo for sure.

Wordpress also seems to use PATH_INFO ( wp-includes/classes.php has a
function called parse-request ) for its clean URL functions, so I
figured I
better enable it. $pathinfo is used a fair bit in the code.


                    if ( isset($_SERVER['PATH_INFO']) )
                            $pathinfo = $_SERVER['PATH_INFO'];
                    else
                            $pathinfo = '';
                    $pathinfo_array = explode('?', $pathinfo);
                    $pathinfo = str_replace("%", "%25",

$pathinfo_array[0]);

Also, I forgot to add that there was a bit of vBulletin code that
behaved
strangely. Essentially it was deleting a number of cookies in a tight
loop.
Obviously this must have been a problem on some platforms as there was
this
remark in the code.

                    if (!defined('SKIP_AGGRESSIVE_LOGOUT'))
                    {
                            // sending this many headers has caused

problems with a few
// servers, especially with IIS.
Defining
SKIP_AGGRESSIVE_LOGOUT
// reduces the number of cookie headers
returned.

Will have to look at the various options for header buffers etc. For
now,
defining SKIP_AGGRESSIVE_LOGOUT bypasses the problems.

Regards,
Shri

----- Original Message -----
From: “Igor S.” removed_email_address@domain.invalid
To: removed_email_address@domain.invalid
Sent: Friday, December 26, 2008 9:35 PM
Subject: Re: Are these rules ok?


#9

On Fri, Dec 26, 2008 at 09:10:06PM +0800, Shri @ DevLib.Org wrote:

After a bit of playing around. I think I have a config that works. (Not
sure I understand some bits, but it does seem to work across all the
various sections of the site).

I now have to port over dozens of rewrites I assume the best way to do this
is to put them in a seperate file and include them under “location /” block?

E.g: #RewriteRule ^hong-kong/(.*)$ http://www.geoexpat.com/resources/
[R=permanent,L]

No, the better include them in separate locations:

location ^~ /hong-kong/ {
     rewrite ^/hong-kong/  http://www.geoexpat.com/resources/ 

permanent;
}

I see PATH_INFO in wordpress and classifieds locations, does this mean
that you were not able to run them without PATH_INFO ? (I see that
vbulliten
has no PATH_INFO processing).

If so, I probably should invent to extract PATH_INFO in easy way.


#10

+1 fastcgi_split_path_info


#11

On Fri, Dec 26, 2008 at 10:33:58PM +0800, Shri @ DevLib.Org wrote:

                   if ( isset($_SERVER['PATH_INFO']) )
                           $pathinfo = $_SERVER['PATH_INFO'];
                   else
                           $pathinfo = '';
                   $pathinfo_array = explode('?', $pathinfo);
                   $pathinfo = str_replace("%", "%25", 

$pathinfo_array[0]);

OK, then I will plan to simplify PATH_INFO extraction some like this:

   fastcgi_path_info   ^(.+\.php)(/.+);

the directive will place 1st capture inside $fastcgi_script_name
and second one inside $fastcgi_path_info.

Other name variants:

   fastcgi_separate_path_info
   fastcgi_split_path_info

What name is better in English ?

SKIP_AGGRESSIVE_LOGOUT
// reduces the number of cookie headers
returned.

Will have to look at the various options for header buffers etc. For now,
defining SKIP_AGGRESSIVE_LOGOUT bypasses the problems.

You may try to increase

  fastcgi_buffer_size   32k;

inside both

  location ~ ^/forum/.+\.php$ {
       fastcgi_buffer_size   32k;
       fastcgi_buffers       4 32k;
       ...
  }

  location @vbulletin {
       fastcgi_buffer_size   32k;
       fastcgi_buffers       4 32k;
       ...
  }

to allow response header up to about 32K.


#12

I like “fastcgi_path_info” because it is most concise; however, I think
“fastcgi_split_path_info” is the better name because it more clearly
expresses the idea of the directive and its effects.

Also, while we’re filling your head with ideas during vacation, I must
say
that just the other day I really wanted location captures! I ended up
finding another way to do what I wanted cleanly, but I can see myself
[ab]using such a feature for all kinds of things in the future…

Thanks and enjoy the rest of your vacation :).


#13

Igor S. wrote:

OK, then I will plan to simplify PATH_INFO extraction some like this:

   fastcgi_path_info   ^(.+\.php)(/.+);

the directive will place 1st capture inside $fastcgi_script_name
and second one inside $fastcgi_path_info.

Other name variants:

   fastcgi_separate_path_info
   fastcgi_split_path_info

What name is better in English ?

Hi, this will be useful, thanks Igor.
I think fastcgi_split_path_info is best.

Cheers
Igor C.


#14

Yes, this is exactly the feature I was thinking of, and, indeed, there
would
be quite a lot of uses for it!


#15

Merlin wrote:

Also, while we’re filling your head with ideas during vacation, I must
say
that just the other day I really wanted location captures! I ended up
finding another way to do what I wanted cleanly, but I can see myself
[ab]using such a feature for all kinds of things in the future…

If by location captures you mean e.g.:

location ~ ^/([a-z]+)/([0-9]+)/?$ {
    # do stuff with $1 $2
}

then I second it - that would be a hugely useful feature.

Thanks,
Igor C.