2014-11-22

lighttpd cgi_mod error when running shell scripts

I've had some issues when trying to run some Bash scripts using lighttpd's cgi_mod: my scripts would not run, and this is what I had in /var/log/lighttpd/error.log:

(mod_cgi.c.1319) cleaning up CGI: process died with signal 6 

Adding server.breakagelog = "/var/log/lighttpd/breakage.log" to /etc/lighttpd/lighttpd.conf did not provide much more information, the log only contained the following line:

mod_cgi.c.1057: aborted

By the way, my cgi.assign variable was defined as in one of the examples in the documentation:

cgi.assign = ( ".sh" => "" )

Anyway, the issue was that my scripts did not have the first line defining which command to run:

#!/bin/bash

Adding this line to each script solved the issue for me. So much for laziness...