nginx serving R scripts via CGI/FastRWeb

Stefan Parvu sparvu at systemdatarecorder.org
Tue Feb 19 12:47:23 UTC 2013


Hi,

Anyone here testing, experimenting with R and nginx ?
Im trying to setup nginx to serve R scripts via 
CGI using Rserve, FastRWeb modules as described here:
http://jayemerson.blogspot.fi/2011/10/setting-up-fastrwebrserve-on-ubuntu.html


My nginx is configured like:

        location ~ ^/cgi-bin/.*\.cgi$ {
            gzip off;
            fastcgi_pass    unix:/opt/sdr/report/ws/fastcgi_temp/nginx-fcgi.sock;
            fastcgi_read_timeout    5m;
            fastcgi_index    index.cgi;
            #fastcgi_buffers  8  4k;
            #
            #  You may copy and paste the lines under or use include directive
            #  include  /etc/nginx/nginx-fcgi.conf;
            #  In this example all is in one file 
            #
            fastcgi_param    SCRIPT_NAME  $fastcgi_script_name;
            fastcgi_param    QUERY_STRING  $query_string;
            fastcgi_param    REQUEST_METHOD  $request_method;
            fastcgi_param    CONTENT_TYPE  $content_type;
            fastcgi_param    CONTENT_LENGTH  $content_length;
            fastcgi_param    GATEWAY_INTERFACE  CGI/1.1;
            fastcgi_param    SERVER_SOFTWARE  nginx;
            fastcgi_param    SCRIPT_NAME  $fastcgi_script_name;
            fastcgi_param    REQUEST_URI  $request_uri;
            fastcgi_param    DOCUMENT_URI  $document_uri;
            fastcgi_param    DOCUMENT_ROOT  /opt/sdr/report/docroot;
            fastcgi_param    SERVER_PROTOCOL  $server_protocol;
            fastcgi_param    REMOTE_ADDR  $remote_addr;
            fastcgi_param    REMOTE_PORT  $remote_port;
            fastcgi_param    SERVER_ADDR  $server_addr;
            fastcgi_param    SERVER_PORT  $server_port;
            fastcgi_param    SERVER_NAME  $server_name;
        }

and Im using fcgiwrap from http://nginx.localdomain.pl/wiki/FcgiWrap.
CGI scripts work fine but Im not able to any R scripts probable due
R being not correctly called via nginx.conf ... 

I am trying something like: http://localhost/cgi-bin/R/foo.png?n=500
and R is a binary file under cgi-bin directory which should call
FastRWeb ... 

Any pointers, help ?

thanks,
Stefan



More information about the nginx mailing list