Starting nginx: : unknown directive "perl_set" in /etc/nginx/nginx.conf:41

Hi,
I’m getting an unknown directive “perl_set” error - I have in my
configuration file :

user www-data;
worker_processes 1;

error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
# multi_accept on;
}

http {
include /etc/nginx/mime.types;

access_log  /var/log/nginx/access.log;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;
tcp_nodelay        on;

gzip  on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

perl_set $client_ip '
sub {
    my $r = shift;
    my $xff = $r->header_in("x-forwarded-for");
    if (!$xff) {
        return $r->remote_addr;
    } else {
        if ($xff =~ /([0-9\.]+).*/) {
            return $1;
        } else {
            return $xff;
        }
    }
}
';

# create a zone called tellapart_one, able to hold 320K IP 

addresses.
limit_zone tellapart_one $binary_remote_addr 20m;

# create zone called tellapart_two, with 320 IP addresses,
# such that rate of requests is at most 1 per s.
limit_req_zone  $binary_remote_addr  zone=tellapart_two:20m 

rate=10r/s;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

}

Can someone tell me what I am doing wrong? I downloaded nginx 0.76 and
confgured it with the perl module.

Thanks,

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,43289,43289#msg-43289

Figured this - I had two installation of nginx on my machine, and one of
them was without perl. So using the right nginx, I could get it to work.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,43289,43290#msg-43290

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs