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
|