Run bash on the web

Enable the required apache modules.

# turn on mod_cgid in the apache config
echo "LoadModule cgid_module modules/mod_cgid.so" >> /etc/httpd/conf/httpd.conf

Create a cgi-bin folder for the scripts to be executed from.

mkdir /srv/http/cgi-bin

Use this header for your scripts.

#!/bin/bash
echo "Content-type: text/html"
echo ""
echo "<meta charset="utf-8">"

Make it executable.

chmod +x /srv/http/cgi-bin/myscript.sh