Welcome! Log In Create A New Profile

Advanced

(TomS) cgi-bin execution of bash shell and C programs?

Posted by TomS 
(TomS) cgi-bin execution of bash shell and C programs?
September 14, 2016 07:59PM
Hello All,

I have created multiple interactive web pages where I store the HTML file in the /var/www/html directory.
These HTML web pages will then call a cgi-bin bash shell script to do the heavy lifting and return the results requested.
I also use the proccgi.c C program in the same location as the cgi shell script to handle the POST info from the web page and
it then hands off the field name information as (from HTML) name=abc to the CGI shell script as FORM_abc.
I have been writing in shell from the early years of Unix.

I have tried to get NGINX to allow execution of both C and SHELL programs on XiVO with NO SUCCESS.
I am new to NGINX vs Apache.
I posted this on the PBX-in-a-Flash Forum and Ward Mundy suggested that I place it on the XiVO Forum.
http://pbxinaflash.com/community/threads/toms-xivo-cgi-bin-problems.20156/#post-125067
I just signed up as a new user and am looking for a long term relationship as I have been using Asterisk since the old Asterick-At-Home (AAH) days.

I am currently testing some of my tools on my VirtualBox running XiVO 16.10.

I am attaching a sample/test HTML file to be placed in the /var/www/html directory called 'testit.html'.
I am also attaching a sample/test bash shell cgi script to be placed in the /usr/lib/cgi-bin directory called 'test.sh'.

If I can find out what needs to be changed to allow the HTML web page to call the CGI shell script (and later the proccgi.c program) and return the info requested, I will be very grateful.

Thank You in advance!
Tom Schmitt (TomS)
dtschmitt@gmail.com
Attachments:
open | download - testit.html (764 bytes)
open | download - testit.sh (1.9 KB)
Re: (TomS) cgi-bin execution of bash shell and C programs?
September 15, 2016 02:14AM
Forking to any type of program is a big 'no' in the nginx world, what you need to do is adopt a fcgi interface, look at how PHP with php-cgi works (tcpip port or socket) with either a fast-cgi or proxy-pass API.

Better yet, if you switch over to Lua (with or without ffi) you will get near fast performance as nginx does by default.

---
nginx for Windows http://nginx-win.ecsds.eu/
Re: (TomS) cgi-bin execution of bash shell and C programs?
September 19, 2016 08:02PM
Not sure what you mean?
The program I want to run is the CGI program although it is in bash shell.
Some how I should be able to create a pure HTML file 'testit.html' and have it run a CGI program to return a screen with the information in it.
Or am I missing something, I do this all the time in pure Apache.
I want to port some of my scripts to XiVO Asterisk platform to allow other users to share my scripts and maybe make their lives easier.
Why is there even a /usr/lib/cgi-bin directory if nothing will run in it?

BTW: Would it be possible to wrap the shell script in a bare bones PHP script and have the PHP script run the shell script?

Thanks,
Tom Schmitt (TomS)
dtschmitt@gmail.com
Re: (TomS) cgi-bin execution of bash shell and C programs?
September 20, 2016 01:53AM
TomS Wrote:
-------------------------------------------------------
> Why is there even a /usr/lib/cgi-bin directory if nothing will run in
> it?

Thats from apache not nginx.

> BTW: Would it be possible to wrap the shell script in a bare bones
> PHP script and have the PHP script run the shell script?

If you have to fork this way it would be preferred.

---
nginx for Windows http://nginx-win.ecsds.eu/
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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