EmbeddedPerlModule question
Igor Sysoev
igor at sysoev.ru
Thu Sep 1 10:06:18 UTC 2011
On Thu, Sep 01, 2011 at 06:01:31PM +0800, li zJay wrote:
> I want to access nginx $uri variable in perl, the following is my nginx.conf
>
> worker_processes 1;
> >
> > events {
> > worker_connections 1024;
> > }
> >
> > http {
> > perl_set $perlvar 'sub {return "ngx_uri:$uri";}';
You should use $r->variable() method to get nginx variable:
'sub {
my $r = shift;
return $r->variable("uri");
}';
or special $r->uri() method for URI:
'sub {
my $r = shift;
return $r->uri;
}';
> > server {
> > listen 80;
> > location / {
> > add_header "perlvar" $perlvar;
> > empty_gif;
> > }
> > }
> > }*
> > *
>
>
> but it doesn't work, nginx $uri variable is empty in perl, can somebody
> figure out what the problem is?
>
> Thanks!
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
--
Igor Sysoev
More information about the nginx
mailing list