2017-09-06 8 views
0

私はフラスコのアプリケーションをfastcgiを使用してlighttpdで起動していますが、マルチパス(例えば/foo/page2)のパスは404エラーになりますが、単一レベルのパスは正常に動作します(例:/ page1)。lighttpdでホストされているフラスコfastcgiはmutlilevelのパスに404を返します

127.0.0.1はlocalhost:5080 - [/ 9月/ 2017年06:16:38:45 +0000] "GET /ページ1 HTTP/1.1" 200

127.0.0.1はlocalhost:5080 - [06/Sep/2017:16:39:07 +0000] "GET/foo/page2 HTTP/1.1" 404

lighttpdではなくフリンジ404のエラーハンドラが表示されます。

flask run経由でアプリケーションを実行すると、マルチレベルパスが正常に動作します。

127.0.0.1 - - [06/9月/ 2017年11時44分56秒] "GET /ページ1 HTTP/1.1" 200

127.0.0.1 - - [06/9月/ 2017年11時44分

:私のルートがどのように見える

server.document-root = "/var/www/" 

server.port = 5080 
server.username = "foobar" 
server.groupname = "foobar" 

server.modules += (
    "mod_fastcgi", 
    "mod_rewrite", 
    "mod_alias", 
    "mod_accesslog" 
) 

$HTTP["url"] !~ "^/static" { 
    fastcgi.server = ("/" => 
     ((
      "socket" => "/tmp/foobar-fcgi.sock", 
      "bin-path" => "/home/foobar/app.fcgi", 
      "check-local" => "disable", 
      "max-procs" => 1 
     )) 
    ) 
} 

# give us debugging output 
fastcgi.debug = 1 

alias.url = (
    "/static" => "/var/www/static" 
) 

::よう56] "GET/fooの/ PAGE2 HTTP/1.1" 200

は私のlighttpd.confに見えます

そして最後にブループリント登録:

app = Flask(__name__) 

app.register_blueprint(PAGE) 
+0

修正はにfastcgi.serverディレクティブを変更することがありますか? –

+0

https://redmine.lighttpd.net/projects/lighttpd/wiki/HowToPythonWSGI – gstrauss

答えて

0

が判明し、 "/" のFastCGIルートは何もマッチしますと(例えば、秒にマッチします "/" で "/ fooの/")。私はあなたが直接フラスコを実行したときにそれが動作すると仮定し

$HTTP["url"] !~ "^/static" { 
    fastcgi.server = ("" => 
     ((
      "socket" => "/tmp/foobar-fcgi.sock", 
      "bin-path" => "/home/foobar/app.fcgi", 
      "check-local" => "disable", 
      "max-procs" => 1 
     )) 
    ) 
} 
関連する問題