"?" в $request_uri

Andrey Ignatov andr.pl at gmail.com
Tue Nov 20 16:18:57 MSK 2007


re all

Есть вот такая конструкция в конфиге:

-------------------------------------
if ($request_uri ~ "^/v/?video=([0-9]+)$") {
	set $clip_id	$1;
	rewrite ^.*$	/video.phtml?clip_id=$clip_id last;
}
-------------------------------------

Делаю браузером:

2007/11/20 12:43:14 [debug] 30732#0: *13 http process request line
2007/11/20 12:43:14 [debug] 30732#0: *13 recv: eof:0, avail:234, err:0
2007/11/20 12:43:14 [debug] 30732#0: *13 recv: fd:27 234 of 1024
2007/11/20 12:43:14 [debug] 30732#0: *13 http request line: "GET /v/?video=28 HTTP/1.0"
2007/11/20 12:43:14 [debug] 30732#0: *13 http uri: "/v/"
2007/11/20 12:43:14 [debug] 30732#0: *13 http args: "video=28"
2007/11/20 12:43:14 [debug] 30732#0: *13 http exten: ""
2007/11/20 12:43:14 [debug] 30732#0: *13 http process request header line
2007/11/20 12:43:14 [debug] 30732#0: *13 http header: "Host: domain.com"
2007/11/20 12:43:14 [debug] 30732#0: *13 http header: "Accept: text/html, text/plain, text/sgml, */*;q=0.01"
2007/11/20 12:43:14 [debug] 30732#0: *13 http header: "Accept-Encoding: gzip, compress"
2007/11/20 12:43:14 [debug] 30732#0: *13 http header: "Accept-Language: en"
2007/11/20 12:43:14 [debug] 30732#0: *13 http header: "User-Agent: Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.7e"
2007/11/20 12:43:14 [debug] 30732#0: *13 http header done


И на проверке регекспов происходит вот такое:

2007/11/20 12:43:14 [debug] 30732#0: *13 http script var
2007/11/20 12:43:14 [debug] 30732#0: *13 http script var: "/v/?video=28"
2007/11/20 12:43:14 [debug] 30732#0: *13 http script regex: "^/v/?video=([0-9]+)$"
2007/11/20 12:43:14 [debug] 30732#0: *13 http script if
2007/11/20 12:43:14 [debug] 30732#0: *13 http script if: false

Т.е. regexp не срабатывает.
В чем тут может быть дело ?

nginx version: nginx/0.6.17
configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt=-I
/usr/local/include --with-ld-opt=-L /usr/local/lib
--conf-path=/usr/local/etc/nginx/nginx.conf
--sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid
--error-log-path=/var/log/nginx-error.log --user=www --group=www
--with-debug
--http-client-body-temp-path=/var/tmp/nginx/client_body_temp
--http-proxy-temp-path=/var/tmp/nginx/proxy_temp
--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp
--http-log-path=/var/log/nginx-access.log --with-http_stub_status_module


-- 
Andrey Ignatov
Skript, System administrator





More information about the nginx-ru mailing list