lighttpd 对于在旧安装上运行的 python 脚本返回 403

问题描述 投票:0回答:1

我有一个在树莓派上运行的 kiln 控制器的 github。我没有写服务器设置。当这开始成为问题时,我确实对其进行了足够的更改以运行 python 3。编写了安装脚本并添加了一些内容。除此之外,我已经运行这个多年了。

我昨天进行了全新安装,我一生都无法弄清楚为什么它返回 403。我将所有文件和文件夹设置为 777,试图找出答案。 lighttpd error.log 未返回任何错误。

我仍然在另一个树莓派上运行它。 Python 3.9.2 和 lighttpd 1.4.59

新安装正在运行Python 3.11.2和lighttpd/1.4.69 python3的符号链接确实在/usr/bin中设置为python3.11

lighttpd.conf

server.modules = (
    "mod_access",
    "mod_alias",
    "mod_compress",
    "mod_redirect",
    "mod_cgi",
)

server.document-root        = "/home/pi/PILN"
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.php", "index.html", "index.lighttpd.html","home.cgi","data.cgi" )
url.access-deny             = ( "~", ".inc" )
static-file.exclude-extensions = ( ".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 
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port 
include_shell "/usr/share/lighttpd/create-mime.conf.pl" 
include "/etc/lighttpd/conf-enabled/*.conf"

$HTTP["url"] =~ "/app/" {
 cgi.assign = ( ".py" => "/usr/bin/python3",".cgi"=> "/usr/bin/python3" )
}

我尝试将所有文件和文件夹设置为 777,因此无法执行应该不是问题。尝试使用不同的 SD 卡重新安装。除此之外,除了软件版本之外没有任何变化。我依稀记得有一次 mime 类型遇到了一些麻烦,但不记得我做了什么来修复它,而且我很确定从那时起我就重新安装了,没有出现任何问题。我尝试在谷歌上搜索推荐的配置是否已更改,并尝试了一些交互(与我已经拥有的非常相似),但没有任何效果。列出的配置与当前在另一台机器上运行的配置相同。

使用这个版本的 python,我确实必须更改部分安装脚本

sudo pip3 install jinja2
sudo pip3 install psutil
sudo pip3 install adafruit-circuitpython-max31856

sudo apt install python3-jinja2
sudo apt install python3-psutil
sudo pip3 install adafruit-circuitpython-max31856 --break-system-packages

这是 git 的链接。 https://github.com/fayena/PILN/我尝试加载的链接是http://IPAddress/app/home.cgi home.cgi调用jinja2模板。

如有任何建议,请采纳。

python python-3.x cgi lighttpd
1个回答
0
投票

好吧,你通过全面升级改变了很多东西,而不仅仅是lighttpd版本。

参见 https://wiki.lighttpd.net/DebugVariables 并尝试

debug.log-request-header-on-error = "enable"

您可以

strace
lighttpd 并查看系统调用失败的位置。

模式 777 几乎从来都不是正确答案或最佳答案。

如果您在运行 lighttpd 1.4.59 的工作设备上打印您的 lighttpd 配置,并在运行 lighttpd 1.4.69 的新安装上打印您的 lighttpd 配置,有什么区别吗?

lighttpd -f /etc/lighttpd/lighttpd.conf -p

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.