linux_wiki:deploy_a_basic_cgi_application

This is an old revision of the document!


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:

  • server1.example.com (192.168.1.150) → Perform all connectivity tests from here
  • server2.example.com (192.168.1.151) → Install Apache Web Server here

Previous Sections Completed


Create the Bash Script

Create a basic script

vim /var/www/cgi-bin/mytime.sh
 
#!/bin/bash
echo "Content-type: text"
echo
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

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