Would you like to learn how to install Nginx and enable the use of Shell Script CGIs on a computer running Ubuntu Linux? In this tutorial, we are going to show you how to enable the CGI feature and enable Shell Scripts to run on the Nginx server.
• Ubuntu 18
• Ubuntu 19
• Ubuntu 20
• Nginx 1.18.0
Equipment list
The following section presents the list of equipment used to create this tutorial.
As an Amazon Associate, I earn from qualifying purchases.
Nginx – Related Tutorial:
On this page, we offer quick access to a list of tutorials related to Nginx.
Tutorial Nginx – Shell Script CGI
Install the Nginx server and the Fcgiwrap package.
Create a configuration file for the CGI gateway.
Here is the file content.
Create a directory to store the CGI files.
Edit the Nginx configuration file for the default website.
Insert the following line in the area named SERVER.
Here is the file, before our configuration.
Here is the file, after our configuration.
Restart the Nginx service.
As an example, let’s create a Shell Script CGI.
Access the Nginx’s CGI directory.
Create a test page using Shell Script.
Here is the file content.
Change the file permission.
Open your browser and enter the IP address of your web server plus /cgi-bin/test.cgi.
In our example, the following URL was entered in the Browser:
• http://192.168.2.113/cgi-bin/test.cgi
The Shell Script page should display the following message.
Congratulations! The Nginx server is now able to use Shell Script as CGI.