运行Django应用程序的Lighttpd出现“child exited with status 13”错误

2024-04-25 17:56:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用mod_fscgi通过lighttpd运行Django应用程序。不幸的是,它总是抛出我无法确定的错误。在

配置如下:

cat /etc/lighttpd/lighttpd.conf 
server.modules              = (
                               "mod_expire",
                               "mod_setenv",
                               "mod_redirect",
                               "mod_rewrite",
                               "mod_compress",
                               "mod_access",
                               "mod_auth",
                               "mod_secdownload",
                               "mod_accesslog",
                               "mod_fastcgi",
#                               "mod_geoip"
)

server.document-root        = "/var/www/default"
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/www/logs/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" )
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" )

expire.url = ("/img/" => "access plus 10 days")

$HTTP["host"] =~ “mydomain\.com” {
    server.document-root = "/var/www/servers/mydomain.com/awesomesite"
    accesslog.filename = "/var/www/logs/mydomain.com/access.log"
    server.errorlog = "/var/www/logs/mydomain.com/error.log"
    fastcgi.server = (
        ".fcgi" => (
            "localhost" => (
                # Use host / port instead of socket for TCP fastcgi
                # "host" => "127.0.0.1",
                # "port" => 3033,
                "bin-path" => "/var/www/servers/mydomain.com/awesomesite/mydomain.fcgi",
                "socket" => "/tmp/mydomain.sock",
                "check-local" => "disable",
                "min-procs" => 2,
                "max-procs" => 4,
                )
           )
     )
}

# 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.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

错误:

^{pr2}$

FCGI文件:

cat /var/www/servers/mydomain.com/awesomesite/mydomain.fcgi 
#!/usr/bin/env python
import sys, os

sys.path.insert(0, "/var/www/servers/mydomain.com")

os.environ['DJANGO_SETTINGS_MODULE'] = "awesomesite.settings"

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")

Tags: commodindexaccessserverportvarwww
1条回答
网友
1楼 · 发布于 2024-04-25 17:56:00

FastCGI正在尝试执行bin-path中指定的脚本。通过发出以下命令,确保脚本/var/www/servers/mydomain.com/awesomesite/mydomain.fcgi设置了执行标志:

ls -l /var/www/servers/mydomain.com/awesomesite/mydomain.fcgi

并验证是否为运行webserver/fastCGI的用户和/或组设置了x标志。在

相关问题 更多 >