ðòïåëôù 


  áòèé÷ 


Apache-Talk @lexa.ru 

Inet-Admins @info.east.ru 

Filmscanners @halftone.co.uk 

Security-alerts @yandex-team.ru 

nginx-ru @sysoev.ru 


  óôáôøé 


  ðåòóïîáìøîïå 


  ðòïçòáííù 



ðéûéôå
ðéóøíá












     áòèé÷ :: nginx-ru
Nginx-ru mailing list archive (nginx-ru@sysoev.ru)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rewrite engine



ñ ÂÙ ËÁË-ÔÏ ÔÁË ÓÄÅÌÁÌ, ÂÅÚ ÒÅ×ÒÁÊÔÁ.


server {

šš listen 80;

šš server_name stat.*********.ru;

šš access_log /var/log/nginx/access.log;

šš error_log /var/log/nginx/error.log debug;

šš root /var/www/lider;


šš location / {

šš š štry_files $uri @backend;

šš }


šš locationš~ \.php$š{

šš š štry_files $uri @backend;

šš š šfastcgi_pass 127.0.0.1:9000;

šš š šfastcgi_index index.php;

šš š šfastcgi_param SCRIPT_FILENAMEš/var/www/lider$fastcgi_script_name;


šš š šinclude fastcgi_params;

šš }


šš location @backend {

šš š šfastcgi_pass 127.0.0.1:9000;

šš š šfastcgi_index index.php;


šš š šinclude fastcgi_params;

šš š šfastcgi_param SCRIPT_FILENAME /var/www/lider/index.php;

šš š šfastcgi_param SCRIPT_NAME /index.php;

šš š šfastcgi_param QUERY_STRING $uri;

šš š šfastcgi_param DOCUMENT_URI /index.php;

šš š šfastcgi_param REQUEST_URI /index.php?$uri;

šš }

}


20 Á×ÇÕÓÔÁ 2010šÇ. 11:04 ÐÏÌØÚÏ×ÁÔÅÌØ Grohotun <nginx-forum@xxxxxxxx> ÎÁÐÉÓÁÌ:
÷ÓÅÍ ÄÏÂÒÙÊ ÄÅÎØ!
ðÅÒÅÎÏÛÕ ÏÄÎÕ ÓÉÓÔÅÍÕ ÎÁ 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"


îÅ ÐÏÍÏÖÅÔÅ?

Posted at Nginx Forum: http://forum.nginx.org/read.php?21,121618,121618#msg-121618


_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://nginx.org/mailman/listinfo/nginx-ru

_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://nginx.org/mailman/listinfo/nginx-ru


 




Copyright © Lexa Software, 1996-2009.