As noted by @basile-starynkevitch, your program output is not compliant with the (very simple) CGI protocol. However, lighttpd will still handle that.
You did not share your lighttpd.conf (lighttpd -f /etc/lighttpd/lighttpd.conf -p
), so I am guessing that you did not properly configure lighttpd mod_cgi to handle the request.
The user account under which the web server is running should have filesystem access to the path and files wherever your web/cgi-bin/
is located.
If this has never worked for you, then also check to see if SELinux is blocking the CGI execution.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…