Я использую lighttpd 1.4.45 на Ubuntu 18LTS на виртуальной машине. Я включил модуль cgi, установил присвоение python (я также попробовал обычный ^ / cgi-bin /) и добавил «.py» в список исключений статического файла.
Моя проблема в том, что, несмотря на правильную настройку python в качестве моего интерпретатора CGI, lighttpd, похоже, по-прежнему ссылается на файлы .py как статические файлы. Загрузка файла Python в любой каталог (включая cgi-bin) приводит к приглашению загрузить файл. Firefox был использован для тестирования.
Мой lighttpd.conf:
server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
"mod_cgi",
)
server.document-root = "/home/william/Desktop/Space.io/"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
server.errorlog = "/var/log/lighttpd/error.log"
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
server.port = 80
index-file.names = ( "index.py", "index.php", "index.html", "index.lighttpd.html" )
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".py", ".php", ".pl", ".fcgi" )
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" )
# default listening port for IPv6 falls back to the IPv4 port
## Use ipv6 if available
#include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
Мой 10-cgi.conf:
# /usr/share/doc/lighttpd/cgi.txt
server.modules += ( "mod_cgi" )
cgi.assign = ( ".pl" => "/usr/bin/perl",
".py" => "/usr/bin/python" )
#$HTTP["url"] =~ "^/cgi-bin/" {
#cgi.assign = ( "" => "" )
#}
## Warning this represents a security risk, as it allow to execute any file
## with a .pl/.py even outside of /usr/lib/cgi-bin.
#
#cgi.assign = (
# ".pl" => "/usr/bin/perl",
# ".py" => "/usr/bin/python",
#)
Почему это происходит? Как правильно настроить lighttpd для запуска файлов python?