HTTP Deploy Basic CGI Application Flashcards Preview

RHCE > HTTP Deploy Basic CGI Application > Flashcards

Flashcards in HTTP Deploy Basic CGI Application Deck (2):
1

Deploy Basic CGI Application

cd /var/www/cgi-bin/

vim mytime.sh
#!/bin/bash
echo "Content-type: text"
echo
echo
echo "This is the current time on the system `date`"

chmod +c mytime.sh

getsebool -a | grep httpd_enable_cgi

setsebool -P httpd_enable_cgi 1

elinks http://web.home.com/cgi-bin/mytime.sh


2

Deploy a non-default CGI Script

mkdir /var/webscripts
vim /var/webscripts/ourtime.sh
#!/bin/bash
echo "Content-type: text"
echo
echo
echo "This is the current time on the system `date`"

semanage fcontext -a -t httpd_sys_script_exec_t "/var/webscripts(/.*)?"
[root@we3kb2 webscripts]# restorecon -Rv /var/webscripts/

vim /etc/httpd/conf/http.conf
Search ScriptAlias

ScriptAlias /cgi-bin/ "/var/webscripts/"
{Directory /var/webscripts}
AllowOverride None
Options None
Require all granted
{/Directory}

systemctl restart httpd

elinks http://web.home.com/cgi-bin/ourtime.sh