2

我试图用 WSGI 和 FastCGI 部署 Plone 5。根据官方 Plone 5 文档的链接,Plone 5 支持使用 WSGI 进行部署。我可以bin/paste serve zope.wsgi根据上面的链接成功运行,看到Plone 5主页。

下一步是用 包装 WSGI 应用程序flup,使其与 FastCGI 兼容。我创建了两个文件:

dispatch_fcgi.py:

#!/usr/bin/env python
ve = '/home/xxx/Plone/zinstance'

import site
site.addsitedir(ve+'/eggs')

from flup.server.fcgi import WSGIServer
from paste.deploy import loadapp

wsgi_app = loadapp('config:'+ve+'/zope.wsgi')

if __name__ == '__main__':
    WSGIServer(wsgi_app).run()

dispatch.fcgi:

#!/bin/bash
this_dir=`dirname $0`

export HOME=/home/xxx
source "$HOME/Plone/zinstance/bin/activate"

err_log_file="${this_dir}/../logs/dispatch_err.log"
exec python "${this_dir}/dispatch_fcgi.py" "$@" 2>>"${err_log_file}"

.htaccess将所有请求重定向到dispatch.fcgi,这会设置所有环境并将参数传递给dispatch_fcgi.py. 后者然后加载 WSGI 配置文件Paste,并运行它。

理想情况下,它的运行应该与使用./bin/paste serve zope.wsgi. 但是,它向我显示了默认的 Zope 页面,我无法访问 ZMI,因为它一直要求我输入密码(我可以使用 访问它paste serve)。此外,该 URL 很奇怪,例如“ http://xxxxxx/dispatch.fcgi/manage ”,其中dispatch.fcgi不应该是其中的一部分。

知道为什么在脚本中执行./bin/paste serve zope.wsgi和运行时行为不同吗?paste

更新:.htaccess

Options +ExecCGI
AddHandler fastcgi-script .fcgi
RewriteEngine On
RewriteRule   ^(dispatch\.fcgi/.*)$  - [QSA,L]
RewriteRule   ^(.*)$  dispatch.fcgi/$1 [QSA,L]
4

0 回答 0