Welcome! Log In Create A New Profile

Advanced

Re: Need help - rewrite from apache to nginx

July 19, 2010 08:00AM
On Sun, Jul 18, 2010 at 08:22:35PM +0300, Veaceslav Grecea wrote:

> Здравствуйте.
>
> Есть вот такие реврайт правила:
>
> RewriteRule detail-property-results-([0-9]+).php$
> /results_detail.php?pageindex=$1&lang=en
> [NC,L]
> RewriteRule detail-property-results.php$
> /results_detail.php
> [NC,L]
> RewriteRule property/([0-9]+)/(.*).php$
> property-detail-2?propertyid=$1&lang=$2
> [R,L]
> RewriteRule property-results-([0-9]+).php$
> /results.php?pageindex=$1&lang=en
> [NC,L]
> RewriteRule property-results.php$
> /results.php?lang=en [NC,L]
>
> Я уже день мучаюсь и никак не могу перенести их под локейшены nginx-а.
> Хотя бы пример по первому правилу.

Я бы сделал так (писать больше, зато сопровождать легче):

location /detail-property-results {

location = /detail-property-results.php {
fastcgi_pass ...
fastcgi_param SCRIPT_FILENAME /path/to/results_detail.php;
fastcgi_param QUERY_STIRNG "";
include fastcgi_params0;
}

location ~ ^/detail-property-results-([0-9]+)\.php$ {
fastcgi_pass ...
fastcgi_param SCRIPT_FILENAME /path/to/results_detail.php;
fastcgi_param QUERY_STIRNG pageindex=$1&lang=en;
include fastcgi_params0;
}

return 404;
}

location /property-results {

location = /property-results.php {
fastcgi_pass ...
fastcgi_param SCRIPT_FILENAME /path/to/results.php;
fastcgi_param QUERY_STIRNG lang=en;
include fastcgi_params0;
}

location ~ ^/property-results-([0-9]+)\.php$ {
fastcgi_pass ...
fastcgi_param SCRIPT_FILENAME /path/to/results.php;
fastcgi_param QUERY_STIRNG pageindex=$1&lang=en;
include fastcgi_params0;
}

return 404;
}

location /property/ {

location ~ ^/property/([0-9]+)/(.*)\.php$ {
return http://$host/property-detail-2?propertyid=$1&lang=$2;
}

return 404;
}


--
Игорь Сысоев
http://sysoev.ru

_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

Need help - rewrite from apache to nginx

Veaceslav Grecea July 18, 2010 01:24PM

Re: Need help - rewrite from apache to nginx

hg_04 July 19, 2010 05:35AM

Re: Need help - rewrite from apache to nginx

Igor Sysoev July 19, 2010 08:00AM

Re: Need help - rewrite from apache to nginx

Veaceslav Grecea July 20, 2010 12:16PM

Re: Need help - rewrite from apache to nginx

hg_04 July 21, 2010 04:28AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 69
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready