Welcome! Log In Create A New Profile

Advanced

Re: nginx serving R scripts via CGI/FastRWeb

Francis Daly
February 20, 2013 04:46PM
On Wed, Feb 20, 2013 at 08:28:27PM +0000, Stefan Parvu wrote:

> location ~ ^/cgi-bin/R/ {

That will match anything starting with /cgi-bin/R/, which is (most of)
what you want.

These requests will...

> fastcgi_pass unix:/opt/sdr/report/ws/fastcgi_temp/nginx-fcgi.sock;

be sent to the fastcgi server.

Now, for all of these requests, you want to tell the fastcgi server to
use the file /opt/sdr/report/docroot/cgi-bin/R. So:

> fastcgi_index index.cgi;

you don't need that, since it will never apply; and

> fastcgi_param SCRIPT_FILENAME /opt/sdr/report/docroot/$fastcgi_script_name;

that should be something that expands to
/opt/sdr/report/docroot/cgi-bin/R. Which is probably
$document_root/cgi-bin/R; you can use whatever matches exactly that
filename. $fastcgi_script_name does not have the correct value by default,
in this case.

> fastcgi_param PATH_INFO $fastcgi_path_info;

If your application uses PATH_INFO, then you'll want to set it something
like that. I don't think that $fastcgi_path_info actually has a value
by default, though.

> 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 REQUEST_URI $request_uri;
> fastcgi_param DOCUMENT_URI $document_uri;
> fastcgi_param DOCUMENT_ROOT /opt/sdr/report/docroot;

They are all fairly standard; probably only the first and last matter,
but it depends on your fastcgi server and your application. The last
one would usually be written to use $document_root, but anything that
ends up with the correct value is good.

Note that your fastcgi server, from the logs you provide, either wants
SCRIPT_FILENAME to be correct, or DOCUMENT_ROOT and SCRIPT_NAME to be
correct; and you don't provide a SCRIPT_NAME.

That may not matter when SCRIPT_FILENAME points to the R binary.

> Testing any calls for /cgi-bin/R/foo returns:
> Cannot get script name, are DOCUMENT_ROOT and SCRIPT_NAME (or SCRIPT_FILENAME) set and is the script executable?
> Cannot get script name, are DOCUMENT_ROOT and SCRIPT_NAME (or SCRIPT_FILENAME) set and is the script executable?

From the above config, SCRIPT_FILENAME was probably
/opt/sdr/report/docroot/cgi-bin/R/foo, which is not an executable file.

> Im trying to see if fastcgi_split_path_info might help anything.

Yes.

http://nginx.org/r/fastcgi_split_path_info

It will change the values of $fastcgi_script_name and $fastcgi_path_info.

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx serving R scripts via CGI/FastRWeb

Stefan Parvu February 19, 2013 07:50AM

Re: nginx serving R scripts via CGI/FastRWeb

Harold Sinclair February 19, 2013 08:52AM

Re: nginx serving R scripts via CGI/FastRWeb

Stefan Parvu February 19, 2013 09:52AM

Re: nginx serving R scripts via CGI/FastRWeb

Harold Sinclair February 19, 2013 11:24AM

Re: nginx serving R scripts via CGI/FastRWeb

Stefan Parvu February 19, 2013 11:42AM

Re: nginx serving R scripts via CGI/FastRWeb

Stefan Parvu February 19, 2013 11:44AM

Re: nginx serving R scripts via CGI/FastRWeb

Francis Daly February 19, 2013 12:26PM

Re: nginx serving R scripts via CGI/FastRWeb

Stefan Parvu February 20, 2013 05:04AM

Re: nginx serving R scripts via CGI/FastRWeb

Francis Daly February 20, 2013 08:26AM

Re: nginx serving R scripts via CGI/FastRWeb

Stefan Parvu February 20, 2013 03:32PM

Re: nginx serving R scripts via CGI/FastRWeb

Francis Daly February 20, 2013 04:46PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 240
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready