2017-09-06 14 views
0

내 flask 응용 프로그램을 fastcgi를 사용하여 lighttpd에서 실행 중이며 모든 다중 레벨 (예 : /foo/page2) 경로가 404 오류를 발생시키는 것을 제외하면 잘 작동하지만 단일 레벨 경로는 잘 작동합니다 (예 :/page1).lighttpd를 통해 호스팅되는 플라스크 fastcgi는 mutlilevel 경로에 대해 404를 반환합니다.

127.0.0.1 로컬 호스트 : 5080 - [/ SIP/2,017 06 : 16 : 38 : 45 +0000] "GET/PAGE1 HTTP/1.1"200

127.0.0.1 로컬 호스트 : 5080 - [06/Sep/2017 : 16 : 39 : 07 +0000] "GET/foo/page2 HTTP/1.1"404

lighttpd가 아닌 404 오류 처리기를 얻을 수 있습니다.

flask run을 통해 응용 프로그램을 실행할 때 다중 레벨 경로가 올바르게 작동합니다. - [06/SIP/2,017 11시 44분 56초] "GET/PAGE1 HTTP/1.1"200

127.0.0.1 - - - [06/SIP/2,017 11시 44분 127.0.0.1

:

:
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는/페이지 2 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 
     )) 
    ) 
}