Project

General

Profile

[Solved] cgi.assign + index-file.names

Added by kawo over 3 years ago

I'm having trouble getting a CGI-based index file to work. The relevant part of my lighttpd config looks like this:

cgi.assign = ( ".py" => "/usr/bin/python3" )
index-file.names = ( "/index.py" )

If I visit /index.py directly it does execute, but when I visit any directory the server just sends the contents of index.py. Is this because mod_cgi uses the URI's extension for cgi.assign, as opposed to the local file's extension? If so, how should I configure lighttpd to make this work?


Replies (4)

RE: [Solved] cgi.assign + index-file.names - Added by gstrauss over 3 years ago

The above works for me. Make sure mod_cgi is listed before mod_staticfile in your modules list, or omit mod_staticfile since it will be automatically added to the end of the modules list.

RE: [Solved] cgi.assign + index-file.names - Added by kawo over 3 years ago

Thanks for the tip, but mod_staticfile isn't in my modules list.

I also noticed my distro's lighttpd is only 1.4.45, but I tried compiling 1.4.48 from source and there was no change.

RE: cgi.assign + index-file.names - Added by gstrauss over 3 years ago

Have you considered providing your entire lighttpd.conf here as an attachment?
lighttpd -f /etc/lighttpd/lighttpd.conf -p
Modify -f path to lighttpd.conf as appropriate

RE: cgi.assign + index-file.names - Added by kawo over 3 years ago

Your first comment was on the right track after all: I fixed the problem by moving mod_indexfile above mod_cgi. This was counter-intuitive to me, but anyway it's working now. Thanks!

    (1-4/4)