nginx serving R scripts via CGI/FastRWeb
Francis Daly
francis at daoine.org
Tue Feb 19 17:24:16 UTC 2013
On Tue, Feb 19, 2013 at 12:47:23PM +0000, Stefan Parvu wrote:
Hi there,
This location:
> location ~ ^/cgi-bin/.*\.cgi$ {
will only match some requests that end in ".cgi" (before the ?, if
that applies).
What you possibly want is a separate location just for your "R" requests.
Something like (untested by me!)
location ^~ /cgi-bin/R/ { }
in which you have your "fastcgi_pass" directive, plus whatever
"fastcgi_param" directives you need to make it work. That is *probably*
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param SCRIPT_FILENAME $document_root/cgi-bin/R;
but the exact details depend on what your fastcgi server wants.
(You may want to set PATH_INFO, if your application uses that.)
See http://nginx.org/r/location for the details of which one location{}
is chosen for each request, and then see the fastcgi documentation to
decide exactly what params you need.
Usually, SCRIPT_FILENAME is "the file on the filesystem that the fastcgi
server should execute"; and other things are "stuff that the fastcgi
server or the application can use to decide what to do".
> 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 ...
In this case, yes. Your nginx configuration was such that your requests
for "R" were not being sent to the fastcgi server.
> 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 ...
Provided that the fastcgi server is able to run whatever file you name in
SCRIPT_FILENAME, and has access to whatever other params it cares about,
something like the above configuration has a chance of working.
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list