Table of Contents

Deploy A Basic CGI Application

General Information

Deploying a basic CGI application via a bash script.


Lab Setup

The following virtual machines will be used:

Previous Sections Completed


Create the Bash Script

Create a basic script

vim /var/www/cgi-bin/mytime.sh
 
#!/bin/bash
echo -e "Content-type: text\n"
echo "This is the current time on the system: $(date)"


Make script executable

chmod +x /var/www/cgi-bin/mytime.sh


Find SELinux CGI boolean to ensure its on

getsebool -a | grep httpd_enable_cgi


If OFF, set it to ON

setsebool -P httpd_enable_cgi 1


Test CGI deployed script

elinks http://bluesite.example.com/cgi-bin/mytime.sh