EmbeddedPerlModule question
li zJay
zjay1987 at gmail.com
Thu Sep 1 10:30:36 UTC 2011
Thank you, it works!
On Thu, Sep 1, 2011 at 6:06 PM, Igor Sysoev <igor at sysoev.ru> wrote:
> 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
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20110901/f59242cc/attachment.html>
More information about the nginx
mailing list