I'm going to show how to executes cgi-bins using this web server.

In a recent post I showed how to install the Monkey http web server on Raspbian so I'll start this post from a working installation. (I'll suppose monkey server has been installed in the /home/pi/monkey-1.2.0/ directory)

The script I want to run is a bash script that reads the Raspberry Pi temperature and prints out the read value.
I described this script in another post (take a look here).

Anyway the source code is the following:


Name this script "temp.cgi" and change file mode bits as follows:


as advices by Mika (linkedin): to spare SD card change the script, in this way you'll avoid the redirection on a file

echo "Content-type: text/html" 
echo "" 
echo "<html><head><title>Raspberry Temperature</title></head><body>" 
echo "Current temperature is $(awk '{print $1}' /sys/class/thermal/thermal_zone0/temp)<br>" 
echo "</body></html>" 



Create the directory cgi-bin


Move the script into the cgi-bin dorectoy

With your favourite editor open the /home/pi/monkey-1.2.0/conf/plugins.load configuration and change the line


    # Load /home/pi/monkey-1.2.0/plugins/cgi/monkey-cgi.so
    Load /home/pi/monkey-1.2.0/plugins/cgi/monkey-cgi.so

Remeber, no tabs are allowed and before the Load command there must be 4 blank spaces.

Now run the Monkey server


Just to try, point your web browser to

That's all.