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:

  • ( → Perform all connectivity tests from here
  • ( → Install Apache Web Server here

Previous Sections Completed

Create the Bash Script

Create a basic script

vim /var/www/cgi-bin/
echo -e "Content-type: text\n"
echo "This is the current time on the system: $(date)"
  • Note: There MUST be a newline after the “Content-type: text” line in order for the cgi script to work correctly. (Either in the form above with 'echo -e' and the '\n' or another empty echo command)

Make script executable

chmod +x /var/www/cgi-bin/

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


  • linux_wiki/deploy_a_basic_cgi_application.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)