Lighttpd and cgi python

99封情书 提交于 2019-12-04 14:57:28

Remove the 'default' assign

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

and use only the second one, perhaps inside the match.

$HTTP["url"] =~ "^/cgi-bin/" {
    cgi.assign = ( ".py" => "/usr/bin/python" )
}

Edit

And make sure that /usr/bin/python exists.

Make sure you have the following in your Lighttpd's mimetypes configuration file:

".py" => "text/x-python",
".pyc" => "application/x-python-code",
".pyo" => "application/x-python-code",

I was running into this issue too. By default, the cgi module is disabled. To enable, try running sudo lighttpd-enable-mod cgi and then /etc/init.d/lighttpd force-reload and try again. Also keep in mind that if you have set cgi.execute-x-only = enable that you need to make your cgi scripts executable e.g. chmod a+x index.py.

If that still doesn't work, you can try adding "mod_cgi" to your server.modules array.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!