passing data to CGI scripts via PATH_INFO

Lyle webmaster at cosmicperl.com
Thu May 22 21:14:23 UTC 2014


On 22/05/2014 19:32, Valentin V. Bartenev wrote:
> On Thursday 22 May 2014 16:26:54 Phil Knight wrote:
>> Hi
>>
>> We are having an issue passing data to CGI scripts via PATH_INFO
>> environment variable.
>>
>> for example:-
>>
>> http://domain.com/cgi-bin/script.cgi/=
>>
>> On  various apache servers this works fine and the PATH_INFO variable
>> will contain "/=", on our nginx server we are getting a 403 forbidden
>> error. We are using fcgiwrap [1] for running CGI and .cgi scripts are
>> executing.
>>
>> Could this be an issue with nginx configuration?
> [..]
>
> Most likely this is an issue with the configuration.

I think the relevant part is here:

location /cgi-bin/ {
             root                /users/folder;
             gzip                off;
             fastcgi_pass        unix:/var/run/fcgiwrap.socket;
             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  SCRIPT_NAME        $fastcgi_script_name;
             fastcgi_param  PATH_INFO         $fastcgi_path_info;
             fastcgi_param  REQUEST_URI        $request_uri;
             fastcgi_param  DOCUMENT_URI       $document_uri;
             fastcgi_param  SERVER_PROTOCOL    $server_protocol;
             fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
             fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
             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;

             fastcgi_param       DOCUMENT_ROOT /users/folder/cgi-bin/;
             fastcgi_param       SCRIPT_FILENAME 
$document_root$fastcgi_script_name;
             fastcgi_connect_timeout 120;
             fastcgi_send_timeout    120;
             fastcgi_read_timeout    120;
         }

I could be wrong. Any pointers would be very much appreciated.

I've noticed that:

http://domain.com/cgi-bin/no_existent_script.cgi

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.


Lyle

> Actually nginx knows nothing about CGI and it's environment variables
> (including PATH_INFO), so you are free to set it any value you think
> reasonable.
>
>    wbr, Valentin V. Bartenev
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140522/14691734/attachment.html>


More information about the nginx mailing list