Python &引用;mod_fcgid:从FastCGI服务器读取数据时出错;对于直接运行时工作的简单fcgi脚本
我有以下fcgi脚本:Python &引用;mod_fcgid:从FastCGI服务器读取数据时出错;对于直接运行时工作的简单fcgi脚本,python,linux,apache,bash,fastcgi,Python,Linux,Apache,Bash,Fastcgi,我有以下fcgi脚本: #! /usr/bin/python import subprocess, sys, os command=["sudo", "-u", "matt", "/home/matt/cgi-bin/peercoin-abe", str(os.getpid())] subprocess.Popen(command, stdin=sys.stdin).wait() peercoin abe包含: #! /bin/sh PYTHONUNBUFFERED=1 exec python
#! /usr/bin/python
import subprocess, sys, os
command=["sudo", "-u", "matt", "/home/matt/cgi-bin/peercoin-abe", str(os.getpid())]
subprocess.Popen(command, stdin=sys.stdin).wait()
peercoin abe包含:
#! /bin/sh PYTHONUNBUFFERED=1 exec python /home/matt/peercoin-explorer/Peercoin-Abe/abe.py \
--config /home/matt/abe-peercoin.conf --static-path static/ --watch-pid="$1" >> /home/matt/abe-peercoin.log
但是当我尝试访问它时,我在错误日志中得到错误:
[Fri Aug 22 22:07:08 2014] [warn] [client 149.254.181.200] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Fri Aug 22 22:07:08 2014] [error] [client 149.254.181.200] Premature end of script headers: peercoin-abe.fcgi
我设置了FcgidIOTimeout 40
和FcgidBusyTimeout 3600
。peercoin-abe.fcgi是可执行文件,由root所有。peercoin abe是可执行文件,由matt所有
所以您希望输出到abe-peercoin.log,但没有。运行peercoin-abe.fcgi会直接导致输出到abe-peercoin.log,正如预期的那样。fcgi对此不是很明确,但问题是由于web用户的权限无法作为matt执行。有必要将其添加到sudoers文件中:
www-data ALL=(matt) NOPASSWD: /home/matt/cgi-bin/peercoin-abe