RE: Странности с QUERY_STRING
maxhl
maxhl на hitline.net.ua
Вт Апр 13 19:31:40 MSD 2010
Скрипт закодирован ионкубом. В апаче все работает. Вот хотел перейти на
php-fpm. Вообще это в продолжении темы в правилами реврайта:
__________________________________________________________________________
DirectoryIndex index.php
AddDefaultCharset UTF-8
<Files license.kist>
order deny,allow
deny from all
</Files>
RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteCond %{QUERY_STRING} (.*)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?permalink=$1&query_str=%1 [L,QSA]
#feed
RewriteRule ^feed/rss/$ _cache/rss_main.xml [L,QSA]
#sitemap
RewriteRule ^sitemap/$ index.php?page=sitemap [L,QSA]
RewriteRule ^sitemap/([0-9]+)/$ index.php?page=sitemap&spage=$1 [L,QSA]
#contact form
RewriteRule ^contact/$ index.php?page=contact_form [L,QSA]
__________________________________________________________________________
Пока сделал как то так:
__________________________________________________________________________
location / {
index index.php;
<------>error_page 404 = @nedrupal;
}
location ~ \.php$ { # location ~ ^.+.php$ {
try_files $uri @nedrupal;
<------>fastcgi_param SCRIPT_FILENAME /home/user/$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
<------>fastcgi_param PATH_INFO $fastcgi_script_name;
<------>fastcgi_pass unix:/tmp/php-fcgi.sock;
<------>fastcgi_pass_request_body off;
<------>client_body_in_file_only clean;
<------>fastcgi_param REQUEST_BODY_FILE $request_body_file;
<------>fastcgi_param<->CONTENT_TYPE<--><------>$content_type;
<------>fastcgi_param<->CONTENT_LENGTH<><------>$content_length;
<------>fastcgi_param DOCUMENT_ROOT<-><------>$document_root;
<------>fastcgi_param<->DOCUMENT_URI<--><------>$document_uri;
<------>fastcgi_param<->GATEWAY_INTERFACE<----->CGI/1.1;
<------>fastcgi_param QUERY_STRING <------>$args;
<------>fastcgi_param<->REMOTE_ADDR<---><------>$remote_addr;
<------>fastcgi_param<->REMOTE_PORT<---><------>$remote_port;
<------>fastcgi_param<->REQUEST_URI<---><------>$request_uri;
<------>fastcgi_param<->REQUEST_METHOD<><------>$request_method;
<------>fastcgi_param<->SERVER_ADDR<---><------>$server_addr;
<------>fastcgi_param<->SERVER_NAME<---><------>$server_name;
<------>fastcgi_param<->SERVER_PORT<---><------>$server_port;
<------>fastcgi_param<->SERVER_PROTOCOL><------>$server_protocol;
<------>fastcgi_param<->SERVER_SOFTWARE <------>nginx/$nginx_version;
<------>fastcgi_param REDIRECT_STATUS 200;
<------>fastcgi_index index.php;
}
location @nedrupal {
<------>fastcgi_param SCRIPT_FILENAME /home/user/index.php;
fastcgi_param SCRIPT_NAME /index.php;
<------>fastcgi_param PATH_INFO /index.php;
<------>fastcgi_pass unix:/tmp/php-fcgi.sock;
<------>fastcgi_pass_request_body off;
<------>client_body_in_file_only clean;
<------>fastcgi_param<->REQUEST_BODY_FILE<----->$request_body_file;
<------>fastcgi_param<->CONTENT_TYPE<--><------>$content_type;
<------>fastcgi_param<->CONTENT_LENGTH<><------>$content_length;
<------>fastcgi_param<->DOCUMENT_ROOT<-><------>$document_root;
<------>fastcgi_param<->DOCUMENT_URI<--><------>$document_uri;
<------>fastcgi_param<->GATEWAY_INTERFACE<----->CGI/1.1;
<------>fastcgi_param<->QUERY_STRING<--><------>permalink=$uri&query_str=$ar
gs;
<------>fastcgi_param<->REMOTE_ADDR<---><------>$remote_addr;
<------>fastcgi_param<->REMOTE_PORT<---><------>$remote_port;
<------>fastcgi_param<->REQUEST_URI<---><------>$request_uri;
<------>fastcgi_param<->REQUEST_METHOD<><------>$request_method;
<------>fastcgi_param<->SERVER_ADDR<---><------>$server_addr;
<------>fastcgi_param<->SERVER_NAME<---><------>$server_name;
<------>fastcgi_param<->SERVER_PORT<---><------>$server_port;
<------>fastcgi_param<->SERVER_PROTOCOL><------>$server_protocol;
<------>fastcgi_param<->SERVER_SOFTWARE <------>nginx/$nginx_version;
<------>fastcgi_param<->REDIRECT_STATUS 200;
}
__________________________________________________________________________
И неработает ...
-----Original Message-----
From: Aleksander [mailto:jjjx128 at mail.ru]
Sent: Tuesday, April 13, 2010 6:24 PM
To: nginx-ru at nginx.org
Subject: Re: Странности с QUERY_STRING
> День добрый.
> Возникли отличия в QUERY_STRING по сравнением с апачем.
> Делаю так:
> fastcgi_param<->QUERY_STRING<--><------>permalink=$uri&query_str=$args;
> В апаче permalink=video-1/Kino-1/&query_str=
> В nginx permalink=/video-1/Kino-1/&query_str=
> Тоесть на слеш больше.
> Как это исправить?
Это в скрипте и апаче надо исправлять.
Можно попробовать вот так:
location ~ ^/(.*)$ {
fastcgi_param QUERY_STRING permalink=$1&query_str=$args;
...
}
_______________________________________________
nginx-ru mailing list
nginx-ru at nginx.org
http://nginx.org/mailman/listinfo/nginx-ru
Подробная информация о списке рассылки nginx-ru