NAME

JRPC::Nginx - JSON-RPC Services in Nginx runtime

SYNOPSIS

Nginx main config /etc/nginx/nginx.conf includes /etc/nginx/conf.d/*.conf. Add a Perl config in /etc/nginx/conf.d/perl.conf (sometimes the name nginx-perl.conf is used):

perl_modules  /home/theuser/src/miscapps/JRPC/examples;
#perl_require  hello_nginx.pm;
perl_require  SimpleMath.pm;

Assign the handler to a URL in your site config (in /etc/nginx/sites-available/)

location /Math { perl JRPC::Nginx::handler; }

DESCRIPTION

JRPC::Nginx allows to host JSON-RPC 2.0 services in Nginx web server runtime similar to Apache2 / mod_perl (See JRPC::Apache2). The main benefit of Nginx is its lightweight memory consumption, scalability for request volume (see various studies) and ultrafast request processing speed.

METHODS

handler($r)

JSON-RPC Handler / Dispatcher for Nginx. This handler has to be assigned to a URL path location in the site configuration in /etc/nginx/sites-available/ (see SYNOPSIS section above). It is not meant to be called explicitly.

For writing service packages and handler methods, see the rest of the JRPC documentation.

REFERENCES

  • For Nginx Perl API See: http://wiki.nginx.org/HttpPerlModule

  • https://threatpost.com/debian-patches-holes-in-nginx-perl-module/103010

Installation of Nginx on Debian (nginx-extras includes Perl module):

sudo apt-get install nginx-extras nginx-doc

nginx-extras contains all the extra Nginx modules (contained in Nginx main codebase) statically linked in.