2012-01-03 1 views
2

Flup 1.0.3 dev 버전을 사용하여 Ubuntu 10.04에서 lighttpd 1.4.26을 실행 중입니다.flup/python으로 lighttpd bin-path 매개 변수를 구성하는 방법

mod_fastcgi를 설정할 때 lighttpd를 시작하기 전에 fcgi를 수동으로 (www- 데이터로) 회전 시키면 lighttpd가 로컬 소켓의 fcgi 프로세스와 통신하도록 할 수 있습니다. 다른 쉘에서 다음

sudo su www-data 
/webapps/test/test.fcgi 

은 ...

sudo /etc/init.d/lighttpd/start 

내가 자동으로 프로세스를 시작합니다 fastcgi.server의 설정에 빈 경로 매개 변수를 사용하려고하면 프로세스가 시작됩니다,하지만하지 않습니다 프로세스와 성공적으로 통신합니다.

내가의 메시지를 격리 한 lighttpd를 \하는 error.log에 다음

성공 (수동 시작) :

2012-01-03 11:56:52: (mod_fastcgi.c.3647) handling it in mod_fastcgi 
2012-01-03 11:56:52: (response.c.468) -- before doc_root 
2012-01-03 11:56:52: (response.c.469) Doc-Root  : /webapps/test 
2012-01-03 11:56:52: (response.c.470) Rel-Path  : /test.fcgi 
2012-01-03 11:56:52: (response.c.471) Path   : 
2012-01-03 11:56:52: (response.c.519) -- after doc_root 
2012-01-03 11:56:52: (response.c.520) Doc-Root  : /webapps/test 
2012-01-03 11:56:52: (response.c.521) Rel-Path  : /test.fcgi 
2012-01-03 11:56:52: (response.c.522) Path   : /webapps/test/test.fcgi 
2012-01-03 11:56:52: (configfile-glue.c.583) === start of condition block === 
2012-01-03 11:56:52: (configfile-glue.c.541) 1 (cached) result: false 
2012-01-03 11:56:52: (configfile-glue.c.583) === start of condition block === 
2012-01-03 11:56:52: (configfile-glue.c.541) 2 (cached) result: false 
2012-01-03 11:56:52: (response.c.539) -- logical -> physical 
2012-01-03 11:56:52: (response.c.540) Doc-Root  : /webapps/test 
2012-01-03 11:56:52: (response.c.541) Rel-Path  : /test.fcgi 
2012-01-03 11:56:52: (response.c.542) Path   : /webapps/test/test.fcgi 
2012-01-03 11:56:52: (mod_fastcgi.c.3071) got proc: pid: 0 socket: unix:/tmp/fcgi.sock load: 1 
2012-01-03 11:56:52: (connections.c.1773) state at exit: 7 handle-req 
2012-01-03 11:56:52: (mod_fastcgi.c.1492) released proc: pid: 0 socket: unix:/tmp/fcgi.sock load: 0 
2012-01-03 11:56:52: (connections.c.1367) state at start 7 handle-req 
2012-01-03 11:56:52: (connections.c.1431) state for fd 7 handle-req 
2012-01-03 11:56:52: (connections.c.1511) state for fd 7 resp-start 
2012-01-03 11:56:52: (response.c.128) Response-Header: 
HTTP/1.1 200 OK^M 
Content-Type: text/plain^M 
Content-Length: 13^M 
Date: Tue, 03 Jan 2012 19:56:52 GMT^M 
Server: lighttpd/1.4.26^M 

실패 :

2012-01-03 11:53:17: (mod_fastcgi.c.3647) handling it in mod_fastcgi 
2012-01-03 11:53:17: (response.c.468) -- before doc_root 
2012-01-03 11:53:17: (response.c.469) Doc-Root  : /webapps/test 
2012-01-03 11:53:17: (response.c.470) Rel-Path  : /test.fcgi 
2012-01-03 11:53:17: (response.c.471) Path   : 
2012-01-03 11:53:17: (response.c.519) -- after doc_root 
2012-01-03 11:53:17: (response.c.520) Doc-Root  : /webapps/test 
2012-01-03 11:53:17: (response.c.521) Rel-Path  : /test.fcgi 
2012-01-03 11:53:17: (response.c.522) Path   : /webapps/test/test.fcgi 
2012-01-03 11:53:17: (configfile-glue.c.583) === start of condition block === 
2012-01-03 11:53:17: (configfile-glue.c.541) 1 (cached) result: false 
2012-01-03 11:53:17: (configfile-glue.c.583) === start of condition block === 
2012-01-03 11:53:17: (configfile-glue.c.541) 2 (cached) result: false 
2012-01-03 11:53:17: (response.c.539) -- logical -> physical 
2012-01-03 11:53:17: (response.c.540) Doc-Root  : /webapps/test 
2012-01-03 11:53:17: (response.c.541) Rel-Path  : /test.fcgi 
2012-01-03 11:53:17: (response.c.542) Path   : /webapps/test/test.fcgi 
2012-01-03 11:53:17: (mod_fastcgi.c.3071) got proc: pid: 23117 socket: unix:/tmp/fcgi.sock-0 load: 1 
2012-01-03 11:53:17: (connections.c.1773) state at exit: 7 handle-req 
2012-01-03 11:53:27: (connections.c.1367) state at start 8 error 
2012-01-03 11:53:27: (connections.c.1746) shutdown for fd 8 
2012-01-03 11:53:27: (connections.c.1598) state for fd 8 close 
2012-01-03 11:53:27: (connections.c.1621) connection closed for fd 8 
2012-01-03 11:53:27: (connections.c.1587) state for fd 8 connect 
2012-01-03 11:53:27: (connections.c.1773) state at exit: 8 connect 

내 된 FastCGI 설정 :

server.modules += ("mod_fastcgi") 

## Start an FastCGI server 
fastcgi.debug = 1 

fastcgi.server = (".fcgi" => 
         ("localhost" => 
         (
         "socket" => "/tmp/fcgi.sock", 
         #"bin-path" => "/webapps/test/test.fcgi", 
         "max-procs" => 1, 
         "check-local" => "disable" 
             ) 
            ) 
           ) 

유일한 변경 사항은 fcgi 파일을 직접 참조하기 위해 bin 경로 줄의 주석 처리를 제거하는 것입니다. 간단한

#!/usr/bin/python2.6 

from flup.server.fcgi import WSGIServer 

def myapp(environ, start_response): 
    print 'got request: %s' % environ 
    start_response('200 OK', [('Content-Type', 'text/plain')]) 
    return ['Hello World!\n'] 

WSGIServer(myapp, bindAddress = '/tmp/fcgi.sock').run() 

내가 lighttpd를 새로운 오전, 그래서 아마도 내가 놓친 거지 뭔가 다음에있는 fcgi 파일의

내용은 단순한 인사의 세계입니다. 미리 감사드립니다!

+0

게시물에 서명하지 마십시오. http://stackoverflow.com/faq#signatures를 참조하십시오. – Amy

답변

1

lighttpd와 Django를 flup으로 설치할 때도 동일한 문제가있었습니다. 소켓 파일 xxx.sock-0에 대해 이전처럼 xxx.sock 대신 flup을 설정하여 해결되었습니다. 너무 효과가있을 수 있습니다.

좀 이상해 보입니다. 나는 리눅스 전문가가 아니며 다른 사람이 해결책을 제시 할 수도 있습니다.

관련 문제