Welcome! Log In Create A New Profile

Advanced

Re: passing data to CGI scripts via PATH_INFO

Lyle
May 23, 2014 05:18AM
On 22/05/2014 22:52, Valentin V. Bartenev wrote:
> On Thursday 22 May 2014 22:14:23 Lyle wrote:
>> ...
>> Also gives a 403. So I suspect that nginx is looking for a file called =
>> in a folder named api.cgi/
>> I'm not sure what configuration we need to do to fix this.
> [..]
>
> As I already said, nginx knows nothing about CGI. It doesn't look for any
> files in your location with "fastcgi_pass". It just passes request and
> all the FastCGI params that you have configured with the values that you
> have set.
>
> For example, since you have:
>
> fastcgi_param PATH_INFO $fastcgi_path_info;
>
> and missing the fastcgi_split_path_info directive, then probably nginx pases
> empty string in PATH_INFO.
>
> Please, check the docs to figure out how exactly the $fastcgi_path_info
> variable works and what values it takes:
> http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#var_fastcgi_path_info

Ah, I see. It's the FastCGI module that's reading the wrong filename.

I think I understand the process now. Nginx is passing variables to the
fastcgi module, as defined in the config. One of these being:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
$fastcgi_script_name being everything after http://.../ by default. So
FastCGI was trying to open a file that didn't exist. The
fastcgi_split_path_info variable addresses this issue, by overloading
$fastcgi_script_name and $fastcgi_path_info with the split from the
regexp. So adding the following:

fastcgi_split_path_info ^(.+\.(?:cgi|pl))(.*)$;

Before the fastcgi_param instructions has fixed the issue. Hooray!


Thanks for your help.


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

passing data to CGI scripts via PATH_INFO

Phil Knight May 22, 2014 11:28AM

Re: passing data to CGI scripts via PATH_INFO

Valentin V. Bartenev May 22, 2014 02:34PM

Re: passing data to CGI scripts via PATH_INFO

Lyle May 22, 2014 05:16PM

Re: passing data to CGI scripts via PATH_INFO

Valentin V. Bartenev May 22, 2014 05:54PM

Re: passing data to CGI scripts via PATH_INFO

Lyle May 23, 2014 05:18AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 196
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