On a fresh install of lighttpd 1.4.11, the mod_alias path for the cgi-bin directory appears to be incorrect.
In order to run a simple CGI script in cgi-bin, I needed to change: (in /etc/lighttpd/mod_cgi.conf)
"/cgi-bin/" => var.basedir + "/cgi-bin/"
"/cgi-bin/" => var.basedir + "/htdocs/cgi-bin/"
With the modified path, the script executes successfully.
>"/cgi-bin/" => var.basedir + "/htdocs/cgi-bin/"
Are you sure this path is correct? I think both apache and lighttpd use /var/www/cgi-bin/ as a default path on Gentoo when not using vhosts.
did you create the cgi-bin directory yourself?
AFAICT no cgi-bin directory is created by the installation. my guess is, you created a cgi-bin dir inside the htdocs dir expecting lighttpd to find it, while in fact, it belongs on the same level.
can you confirm my observation?
I cannot confirm, as I am not at that system. However, having checked the ebuild it appears that you are correct. I will check the ebuild properly next time, my apologies.