Welcome! Log In Create A New Profile

Advanced

Re: another rewrite/try files issue

António P. P. Almeida
May 23, 2011 04:26PM
On 23 Mai 2011 20h31 WEST, sgsfak@gmail.com wrote:

> 2011/5/23 brianmercer <nginx-forum@nginx.us>:
>> 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;
>> }
>
> Thanks again!
>
> I finally did the following which seems to work just fine:
>
> location ~ /myapp/(.*) {
> root /home/stelios/myapp;
> set $args u=/$1&$args;
> try_files /$1 @fallback;
> }

You can do it without any set directive. Try this.

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

location = /index.php {
root /home/stelios/myapp;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
## Remove the line below if already defined in fastcgi_params.
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

--- appa

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
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: 312
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