Thank you, it works!<br><br><div class="gmail_quote">On Thu, Sep 1, 2011 at 6:06 PM, Igor Sysoev <span dir="ltr"><<a href="mailto:igor@sysoev.ru">igor@sysoev.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On Thu, Sep 01, 2011 at 06:01:31PM +0800, li zJay wrote:<br>
> I want to access nginx $uri variable in perl, the following is my nginx.conf<br>
><br>
> worker_processes 1;<br>
> ><br>
> > events {<br>
> > worker_connections 1024;<br>
> > }<br>
> ><br>
> > http {<br>
> > perl_set $perlvar 'sub {return "ngx_uri:$uri";}';<br>
<br>
</div>You should use $r->variable() method to get nginx variable:<br>
<br>
'sub {<br>
my $r = shift;<br>
return $r->variable("uri");<br>
}';<br>
<br>
or special $r->uri() method for URI:<br>
<br>
'sub {<br>
my $r = shift;<br>
return $r->uri;<br>
<div class="im">}';<br>
<br>
> > server {<br>
> > listen 80;<br>
> > location / {<br>
> > add_header "perlvar" $perlvar;<br>
> > empty_gif;<br>
> > }<br>
> > }<br>
> > }*<br>
> > *<br>
><br>
><br>
> but it doesn't work, nginx $uri variable is empty in perl, can somebody<br>
> figure out what the problem is?<br>
><br>
> Thanks!<br>
<br>
</div>> _______________________________________________<br>
> nginx mailing list<br>
> <a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
> <a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
<font color="#888888"><br>
<br>
--<br>
Igor Sysoev<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</font></blockquote></div><br><br><br>