cgi-bin and nginx

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

cgi-bin and nginx

The Doctor
Hello I am trying to migrate from Apache to nginx.

Straight forward HTML no problem.

Cgi-bin issues are stopping me.

So In my https system I have

        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: timer delta: 1
2020/08/09 21:25:24 [debug] 50073#101493: worker cycle
2020/08/09 21:25:24 [debug] 50073#101493: kevent timer: 59999, changes: 0
2020/08/09 21:25:24 [debug] 50073#101493: kevent events: 1
2020/08/09 21:25:24 [debug] 50073#101493: *1 event timer add: 10: 60000:34559651
3
2020/08/09 21:25:24 [debug] 50073#101493: *1 http finalize request: -4, "/cgi-bi
n/syswatch.pl?" a:1, c:2
2020/08/09 21:25:24 [debug] 50073#101493: *1 http request count:2 blk:0
2020/08/09 21:25:24 [debug] 50073#101493: timer delta: 2
2020/08/09 21:25:24 [debug] 50073#101493: worker cycle
2020/08/09 21:25:24 [debug] 50073#101493: kevent timer: 60000, changes: 2
2020/08/09 21:25:24 [debug] 50073#101493: kevent events: 1
2020/08/09 21:25:24 [debug] 50073#101493: kevent: 3: ft:-2 fl:0020 ff:00000000 d
:33751 ud:00000008028BC9B8
2020/08/09 21:25:24 [debug] 50073#101493: *1 http run request: "/cgi-bin/syswatc
h.pl?"
2020/08/09 21:25:24 [debug] 50073#101493: *1 http upstream check client, write e
vent:1, "/cgi-bin/syswatch.pl"
2020/08/09 21:25:24 [debug] 50073#101493: timer delta: 1
2020/08/09 21:25:24 [debug] 50073#101493: worker cycle
2020/08/09 21:25:24 [debug] 50073#101493: kevent timer: 59999, changes: 0
2020/08/09 21:25:24 [debug] 50073#101493: kevent events: 1
2020/08/09 21:25:24 [debug] 50073#101493: kevent: 10: ft:-1 fl:0020 ff:00000000 d:104 ud:000000080289FD20
2020/08/09 21:25:24 [debug] 50073#101493: *1 http upstream request: "/cgi-bin/syswatch.pl?"
2020/08/09 21:25:24 [debug] 50073#101493: *1 http upstream process header
2020/08/09 21:25:24 [debug] 50073#101493: *1 malloc: 0000000801F8C000:4096
2020/08/09 21:25:24 [debug] 50073#101493: *1 recv: eof:0, avail:104, err:0
2020/08/09 21:25:24 [debug] 50073#101493: *1 recv: fd:10 104 of 4096
2020/08/09 21:25:24 [debug] 50073#101493: *1 http fastcgi record byte: 01
2020/08/09 21:25:24 [debug] 50073#101493: *1 http fastcgi record byte: 06
2020/08/09 21:25:24 [debug] 50073#101493: *1 http fastcgi record byte: 00
2020/08/09 21:25:24 [debug] 50073#101493: *1 http fastcgi record byte: 01
2020/08/09 21:25:24 [debug] 50073#101493: *1 http fastcgi record byte: 00
2020/08/09 21:25:24 [debug] 50073#101493: *1 http fastcgi record byte: 42
2020/08/09 21:25:24 [debug] 50073#101493: *1 http fastcgi record byte: 06
2020/08/09 21:25:24 [debug] 50073#101493: *1 http fastcgi record byte: 00
2020/08/09 21:25:24 [debug] 50073#101493: *1 http fastcgi record length: 66
2020/08/09 21:25:24 [debug] 50073#101493: *1 http fastcgi parser: 0
2020/08/09 21:25:24 [debug] 50073#101493: *1 http fastcgi header: "Status: 403 Forbidden"
2020/08/09 21:25:24 [debug] 50073#101493: *1 http fastcgi parser: 0
2020/08/09 21:25:24 [debug] 50073#101493: *1 http fastcgi header: "Content-Type: text/plain"
2020/08/09 21:25:24 [debug] 50073#101493: *1 http fastcgi parser: 1
2020/08/09 21:25:24 [debug] 50073#101493: *1 http fastcgi header done
2020/08/09 21:25:24 [debug] 50073#101493: *1 posix_memalign: 0000000801FD4000:4096 @16
2020/08/09 21:25:24 [debug] 50073#101493: *1 HTTP/1.1 403 Forbidden
Server: nginx/1.18.0
Date: Mon, 10 Aug 2020 03:25:24 GMT
Content-Type: text/plain
Transfer-Encoding: chunked
Connection: keep-alive


What is not correct?

--
Member - Liberal International This is doctor@@nl2k.ab.ca Ici doctor@@nl2k.ab.ca
Yahweh, Queen & country!Never Satan President Republic!Beware AntiChrist rising!
https://www.empire.kred/ROOTNK?t=94a1f39b 
That man is the richest whose pleasures are the cheapest.  -Henry David Thoreau
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: cgi-bin and nginx

Francis Daly
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/syswatch.pl?"
> 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:
  /usr/local/www/apache24/cgi-bin//cgi-bin/syswatch.pl"

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/syswatch.pl

or

  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,

        f
--
Francis Daly        [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx