nginx serving R scripts via CGI/FastRWeb

Stefan Parvu sparvu at systemdatarecorder.org
Wed Feb 20 10:00:04 UTC 2013


> 
> Something like (untested by me!)
>   location ^~ /cgi-bin/R/ { }
>

yep correct. I do have now on cgi-bin directory a binary file called: R.
I did change my nginx.conf to have a new location definition for the 
R calls, like here:

        location ~ ^/cgi-bin/R$ {
            gzip off;
            fastcgi_pass    unix:/opt/sdr/report/ws/fastcgi_temp/nginx-fcgi.sock;
            fastcgi_param    REQUEST_METHOD     $request_method;
            fastcgi_param    SCRIPT_FILENAME /opt/sdr/report/docroot$fastcgi_script_name;
            fastcgi_param    PATH_INFO $fastcgi_path_info;

            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;
        }

This works if I put in my browser:
  http://localhost:9001/cgi-bin/R I get some error in the browser but it does
seem to work since I did not input any parameters to R call.

But when I try: http://localhost:9001/cgi-bin/R/foo?n=50
this returns with same error that there is no such directory, seems somehow
the request it is not passed via CGI to FastWebR.
 
2013/02/20 11:52:01 [error] 3637#0: *9 open()
"/opt/sdr/report/docroot/cgi-bin/R/foo" failed (20: Not a directory), client:
127.0.0.1, server: sdrrep, request: "GET /cgi-bin/R/foo?n=50 HTTP/1.1", host:
"localhost:9001"

> In this case, yes. Your nginx configuration was such that your requests
> for "R" were not being sent to the fastcgi server.

And still they are not passed correctly.
something still messed up with my nginx.conf 
 
you can see entire nginx.conf here:
 http://www.systemdatarecorder.org/nginx.conf


Stefan



More information about the nginx mailing list