CGI (Acronym in English for Common Gateway Interface), in Portuguese, a common entrance door interface. Interface: Element that provides a physical or logical connection between two systems or parts of a system that could not be connected directly.
Taking into account the speed with which innovations happen, CGI can be considered old, taking into consideration the creation of the computer can be said that it is in middle age.
In 1993, the team The National Center for Supercomputing Applications (NCSA) wrote a specification to call command line executables at www-voltal email list. However, NCSA does not host the specification.
Other developers have adopted the specification, and has been a standard for web servers ever since. A group chaired by Ken Coar began a job in November 1997 to obtain the most formally defined NCSA definition. This work resulted in RFC3875, which specifies the CGI 1.1 version. Expressly mentioned in the RFC are the following taxpayers:
Rob McCool (author of NCSA HTTPD Web Server) John Franks (Author of Web Server GN) Ari Lotonen (CERN HTTPD Web server developer) Tony Sanders (Plexus Web server author) George Phillips (Web server maintenance at the University of British Columbia).
As an alternative you can consider:
cd /usr/lib/cgi-bin apt install apache2
a2enmod cgid
a2enmod rewrite
systemctl restart apache2
nano /etc/apache2/mods-available/cgi.load
nano /etc/apache2/mods-enabled/cgi.load
nano /etc/apache2/mods-enabled/mime.conf

Generally, the HTTP server has a directory (folder), which is designated as a collection of documents (files), which can be sent to web browsers linked to this server. CGI extends this system, allowing the web server owner to designate a directory within the document collection containing executable scripts (or binary files) instead of prescribed pages, this is known as a CGI directory.
cd /usr/lib/cgi-bin
General Structure of Scripts CGI: • Data reading and decoding (and/or information fields of an HTTP package); • Data processing (record information on databases, perform calculations, recover data); • Creation of a web page with the results produced.
Examples of CGI's application data processing submitted through forms;
Serve as an interface with the databases, converting the HTML transaction to SQL and formatting to HTML the answers obtained, then sent the results to the customer;
http://54.174.113.206/cgi-bin/index.sh