Welcome! Log In Create A New Profile

Advanced

Re: another rewrite/try files issue

May 23, 2011 02:02PM
Stelios Sfakianakis Wrote:
-------------------------------------------------------
> On 23/5/2011 1:06 πμ, brianmercer wrote:
> > Possibly this:
> >
> > location /myapp/ {
> > root /home/stelios;
> > try_files $uri @fallback;
> > }
> >
> > # and the "default" PHP/FastCGI
> > location @fallback {
> > fastcgi_pass 127.0.0.1:9000;
> > fastcgi_param SCRIPT_FILENAME
> /home/stelios/myapp/index.php;
> > include fastcgi_params;
> > }
> >
>
> Thanks Brian, that *almost* works (although I
> don't like repeating [most
> of] the fastcgi config..)
>
> But I also need to pass *part* of the original
> path as a query string. I
> tried to following :
>
> location @fallback {
> fastcgi_pass 127.0.0.1:9000;
> include fastcgi_params;
> fastcgi_param SCRIPT_FILENAME
> /home/stelios/myapp/index.php;
> fastcgi_param QUERY_STRING u=$uri&$args;
> }
>
>
> which works but now for the url ".../myapp/users"
> the script gets a
> query string like this: "u=/myapp/users" whereas I
> want it to be
> "u=/users" (i.e. remove the "base" path). Is there
> any simple solution
> to that? (e.g. can we pass parameters to a named
> location?)
>
> Thanks!
> Stelios
>
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx

Oh, I see. Maybe this:

location ~ /myapp/(?<myquery>.*) {
root /home/stelios;
try_files $uri /myapp/index.php?u=/$myquery;
}

location = /myapp/index.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /home/stelios/myapp/index.php;
include fastcgi_params;
}
Subject Author Posted

another rewrite/try files issue

Stelianos G. Sfakianakis May 22, 2011 05:22PM

Re: another rewrite/try files issue

brianmercer May 22, 2011 06:06PM

Re: another rewrite/try files issue

Stelios Sfakianakis May 23, 2011 02:54AM

Re: another rewrite/try files issue

brianmercer May 23, 2011 02:02PM

Re: another rewrite/try files issue

Stelianos G. Sfakianakis May 23, 2011 03:32PM

Re: another rewrite/try files issue

António P. P. Almeida May 23, 2011 04:26PM

Re: another rewrite/try files issue

Igor Sysoev May 23, 2011 04:04PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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