cgi-bin and nginx

Francis Daly francis at
Mon Aug 10 09:43:42 UTC 2020

On Sun, Aug 09, 2020 at 09:34:20PM -0600, The Doctor wrote:

Hi there,

>         location /cgi-bin/ {
> 		#try_files $uri =404 ;
> 		gzip off;
> 		root /usr/local/www/apache24/cgi-bin/;
> 		fastcgi_pass unix:/var/run/fcgiwrap/fcgiwrap.sock;
> 		include /usr/local/etc/nginx/fastcgi_params;
> 		fastcgi_param SCRIPT_FILENAME /usr/local/www/apache24/cgi-bin/$fastcgi_script_name;
> 											}

> And In my error log I have

> 2020/08/09 21:25:24 [debug] 50073#101493: *1 http upstream request: "/cgi-bin/"
> 2020/08/09 21:25:24 [debug] 50073#101493: *1 http upstream process header

> 2020/08/09 21:25:24 [debug] 50073#101493: *1 http fastcgi header: "Status: 403 Forbidden"

I think that says that your fastcgi server is returning 403 to nginx,
so nginx is returning that to the client.

You should probably ask your fastcgi server why it is returning 403.

If you look back a bit in your error log, you will probably see some
lines like

  fastcgi param: "SCRIPT_FILENAME:

which indicate exactly what key/value pairs nginx is presenting to your
fastcgi server.

If the fastcgi server logs are not clear enough, perhaps you can use those
"fastcgi param" values to work out what is going wrong.

Does the user that the fastcgi service runs as, have access to execute
the file that nginx invites it to process? Perhaps, as that user

  ls -l /usr/local/www/apache24/cgi-bin//cgi-bin/


  ls -ld /usr/local/www/apache24/cgi-bin/cgi-bin/
  ls -ld /usr/local/www/apache24/cgi-bin/
  ls -ld /usr/local/www/apache24/

etc will show if there is a permission problem?

Good luck with it,

Francis Daly        francis at

More information about the nginx mailing list