Rewrite engine

Sergey Shepelev temotor gmail.com
20 14:05:19 MSD 2010


2010/8/20 Grohotun <nginx-forum at nginx.us>:
>   !
>     nginx + fastcgi c
> .
>     .htaccess:
>
> AddDefaultCharset UTF-8
> DirectoryIndex index.php
>
> RewriteEngine on
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
>
>
>     ӣ  
> index.php?auth/login  index.php/auth/login
>   .
>  :
> server {
> listen 80;
> server_name stat.*********.ru;
> access_log /var/log/nginx/access.log;
> error_log /var/log/nginx/error.log debug;
>
> location / {
>    root /var/www/lider;
>    index index.php;
>    rewrite_log on;
>
>    if (!-f $request_filename){
>        set $rule_0 1$rule_0;
>    }
>    if (!-d $request_filename){
>        set $rule_0 2$rule_0;
>    }
>    if ($rule_0 = "21"){
>        rewrite ^/(.php)$ /index.php?/$1 last;
>    }
>
> }
> location ~ \.php$ {
>    root /var/www/lider;
>    fastcgi_pass 127.0.0.1:9000;
>    fastcgi_index index.php;
>    fastcgi_param SCRIPT_FILENAME
> /var/www/lider$fastcgi_script_name;
>    include fastcgi_params;
>    }
> }
>
>    :
> 2010/08/20 11:02:58 [notice] 16433#0: *1 "^/(.*)$" matches
> "/index.php/auth/login", client: 77.241.**.**, server: stat.*******.ru,
> request: "GET /index.php/auth/login HTTP/1.1", host:
> "stat.**********.ru"
> 2010/08/20 11:02:58 [notice] 16433#0: *1 rewritten data: "/index.php",
> args: "/index.php/auth/login", client: 77.241.***.***, server:
> stat.*******ru, request: "GET /index.php/auth/login HTTP/1.1", host:
> "stat.********.ru"
>
>
>  ?
>

-: rewrite    Query  (ӣ   ? 
).   /index.php?foobar    ?
     ?


-:   if.

location / {
  root /var/www/lider;
  index index.php;
  rewrite_log on;

  try_files $uri $uri/ /index.php;  #    , 
index.php   PHP 
}

location = /index.php {
  fastcgi_pass 127.0.0.1:9000;
  fastcgi_param SCRIPT_FILENAME /var/www/lider/index.php;

#  ,    /index.php?foobar     PHP 
 /index.php/foobar
  fastcgi_param PATH_INFO $query_string;

  include fastcgi_params;
}


nginx-ru