我正在爲使用django的客戶端構建網站。它被託管在共享主機上,mod_wsgi無法使用。在過去的一年裏,我使用fcgi開始工作,但是當我回來的時候,它被打破了。獲取flup fcgi腳本難以工作
我已經取代了FCGI腳本簡單的Hello World腳本:
#!/usr/bin/python
def myapp(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/plain')])
return ['Hello World!\n']
try:
from flup.server.fcgi import WSGIServer
WSGIServer(myapp).run()
except:
import sys, traceback
traceback.print_exc(file=open("errlog.txt","a"))
測試,我的本地服務器上的工作,但託管服務器上,我得到這個錯誤:
<title>FCGI Error</title>
A timeout occured while waiting for the script output (in: /usr/www/users/mymemb/).
如果我看錯誤日誌,我看到:
[Wed Jan 6 16:59:37 2010] [warn] FastCGI: (dynamic) server "/usr/www/users/mymemb/mymembers.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 10 seconds
[Wed Jan 6 16:59:38 2010] [warn] FastCGI: (dynamic) server "/usr/www/users/mymemb/mymembers.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 10 seconds
[Wed Jan 6 16:59:38 2010] [warn] FastCGI: (dynamic) server "/usr/www/users/mymemb/mymembers.fcgi" (user mymemb, gid 100) restarted (pid 1057)
[Wed Jan 6 16:59:38 2010] [warn] FastCGI: (dynamic) server "/usr/www/users/mymemb/mymembers.fcgi" (pid 1057) terminated by calling exit with status '118'
[Wed Jan 6 16:59:38 2010] [warn] FastCGI: (dynamic) server "/usr/www/users/mymemb/mymembers.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 10 seconds
[Wed Jan 6 16:59:38 2010] [warn] FastCGI: (dynamic) server "/usr/www/users/mymemb/mymembers.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 10 seconds
[Wed Jan 6 16:59:38 2010] [warn] FastCGI: (dynamic) server "/usr/www/users/mymemb/mymembers.fcgi" has failed to remain running for 30 seconds given 3 attempts, its restart interval has been backed off to 10 seconds
etc ...
如果我SSH服務器,我可以運行腳本很好,輸出如下:
[email protected]:~/public_html$ ./mymembers.fcgi
WSGIServer: missing FastCGI param REQUEST_METHOD required by WSGI!
WSGIServer: missing FastCGI param SERVER_NAME required by WSGI!
WSGIServer: missing FastCGI param SERVER_PORT required by WSGI!
WSGIServer: missing FastCGI param SERVER_PROTOCOL required by WSGI!
Status: 200 OK
Content-Type: text/plain
Content-Length: 13
Hello World!
我該如何解決這個問題?
新增信息:
好像腳本不運行在所有。如果我在腳本的頂部添加import x,並從ssh運行它,我會看到創建了x.pyc。如果我rm x.pyc,然後點擊該網站,x.pyc不會被創建。
我也注意到,從
terminated by calling exit with status '118'
改爲
terminated by calling exit with status '116'
的錯誤,我希望我能找到這些退出狀態的參考。
你用什麼服務器來運行mymembers.fcgi? – Tobu 2010-01-10 16:17:56
Debian Etch,Apache 1.3 該網址是http://www.mymembers.co.za/ – 2010-01-10 16:37:06
我懷疑mod_fastcgi配置錯誤。請發佈或粘貼您的apache配置的相關部分。 – Tobu 2010-01-10 19:30:24