Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 找不到静态文件-带有fastcgi fcgi的Lighttpd_Python_Lighttpd_Fastcgi - Fatal编程技术网

Python 找不到静态文件-带有fastcgi fcgi的Lighttpd

Python 找不到静态文件-带有fastcgi fcgi的Lighttpd,python,lighttpd,fastcgi,Python,Lighttpd,Fastcgi,我的python文件在fcgi中很有趣,没有问题,但是我的静态内容产生了404个错误 我的fastcgi.conf: server.modules += ( "mod_fastcgi" ) fastcgi.server = ("/" => (( "socket" => "/tmp/webxyz-fcgi.sock", "bin-path" => "/opt/local/www/xyz/webxyz.fcgi", "ch

我的python文件在fcgi中很有趣,没有问题,但是我的静态内容产生了404个错误

我的fastcgi.conf:

server.modules += ( "mod_fastcgi" )
fastcgi.server = ("/" =>
    ((  
        "socket" => "/tmp/webxyz-fcgi.sock",
        "bin-path" => "/opt/local/www/xyz/webxyz.fcgi",
        "check-local" => "disable",
        "max-procs" => 1
    ))  
)

alias.url = ( 
    "/static" => "/opt/local/www/xyz/app/static"
)

url.rewrite-once = ( 
    #"^(/static($|/.*))$" => "$1",
    "^(/static.*)$" => "$1",
    "^(/.*)$" => "/webxyz.fcgi$1"
)
server.modules += ( "mod_fastcgi" )
$HTTP["url"] !~ "^/static" {
    fastcgi.server = ("/" =>
        ((  
            "socket" => "/tmp/webpdb-fcgi.sock",
            "bin-path" => "/opt/local/www/xyz/webxyz.fcgi",
            "check-local" => "disable",
            "max-procs" => 1
        ))  
    )   
}

alias.url = ( 
    "/static" => "/opt/local/www/xyz/app/static"
)

url.rewrite-once = ( 
    #"^(/static($|/.*))$" => "$1",
    "^(/static.*)$" => "$1",
    "^(/.*)$" => "/webxyz.fcgi$1"
)
我打开了一些调试:

debug.log-request-handling        = "enable"
debug.log-request-header-on-error = "enable"
debug.log-file-not-found          = "enable"
(奇怪的是,找不到文件似乎没有任何作用…)

下面是我在error.log中看到的一个静态文件-所有其他文件都会产生类似的输出(下面的省略号是一堆只在行号上变化的非信息性条件块):

它查看的最后一个路径,/opt/local/www/xyz/app/static是我的静态目录,包含bower_components/x-editable/dist/bootstrap3-editable/js/bootstrap-editable.js

我不确定为什么找不到它-权限很好:

sudo -u www cat /opt/local/www/xyz/app/static/bower_components/x-editable/dist/bootstrap3-editable/js/bootstrap-editable.js
一切正常

欢迎提供任何指导或建议。

好的

因此,在阅读本文时,我发现我对werkzeug.contrib.fixers.CGIRootFix的使用导致我将fcgi的范围定义为“/”,它优先于url,并重写“/静态”的规则。将fcgi服务器包装为排除对以“/static”开头的URL的请求,可以解决没有提供静态内容的问题

下面是正在工作的fastcgi.conf:

server.modules += ( "mod_fastcgi" )
fastcgi.server = ("/" =>
    ((  
        "socket" => "/tmp/webxyz-fcgi.sock",
        "bin-path" => "/opt/local/www/xyz/webxyz.fcgi",
        "check-local" => "disable",
        "max-procs" => 1
    ))  
)

alias.url = ( 
    "/static" => "/opt/local/www/xyz/app/static"
)

url.rewrite-once = ( 
    #"^(/static($|/.*))$" => "$1",
    "^(/static.*)$" => "$1",
    "^(/.*)$" => "/webxyz.fcgi$1"
)
server.modules += ( "mod_fastcgi" )
$HTTP["url"] !~ "^/static" {
    fastcgi.server = ("/" =>
        ((  
            "socket" => "/tmp/webpdb-fcgi.sock",
            "bin-path" => "/opt/local/www/xyz/webxyz.fcgi",
            "check-local" => "disable",
            "max-procs" => 1
        ))  
    )   
}

alias.url = ( 
    "/static" => "/opt/local/www/xyz/app/static"
)

url.rewrite-once = ( 
    #"^(/static($|/.*))$" => "$1",
    "^(/static.*)$" => "$1",
    "^(/.*)$" => "/webxyz.fcgi$1"
)