2012-01-03 9 views
2

私はFlup 1.0.3の開発版でUbuntu 10.04でlighttpd 1.4.26を実行しています。flup/pythonでlighttpd bin-pathパラメータを設定するには

lighttpdを起動する前にmod_fastcgiを設定すると、fcgiを手動で(www-データとして)起動すると、lighttpdがローカルソケット上のfcgiプロセスと通信できるようになります。

別のシェルで、その後
sudo su www-data 
/webapps/test/test.fcgi 

...

sudo /etc/init.d/lighttpd/start 

私は自動的にこのプロセスを開始するためにfastcgi.serverの設定でビン-pathパラメータを使用しようとすると、プロセスが開始されるのではなく、プロセスと正常に通信します。

私は内のメッセージを単離した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のflupをxxx.sockの代わりに設定して解決しました。 あなたのためにもうまくいくかもしれません。

これは少しハッキリです。私はLinuxの教祖ではなく、誰かが解決策で応答するかもしれない。

関連する問題