我的 Dancer应用程序在 uWSGI (2.0.7) + Apache (2.4.10) 组合下失败,而它在其他环境中自由运行(uWSGI + nginx,Starman + Apache,Dancer 自己的开发服务器)。我在日志中找不到任何有意义的信息。所以我制作了简单的测试应用程序,例如
$ dancer -a tset
然后复制默认
production.yml
进入 uwsgi.yml
, 链接 bin/app.pl
进入 bin/app.psgi
已创建 tset.ini
像这样:[uwsgi]
plugins = psgi
socket = 127.0.0.1:3033
uid = www
gid = www-data
chdir = /home/www/apps/tset/bin/
psgi = app.psgi
processes = 1
master = true
在
/etc/uwsgi/apps-available
中使这个 ini 可用于 uWsgi ,链接到/etc/uwsgi/apps-enabled
.重启
uwsgi
服务。然后对于 Apache (2.4.10) 模块
mod-proxy-uwsgi
在我的虚拟主机 conf 中添加了几行:ProxyPass /adm/y uwsgi://127.0.0.1:3033/
这似乎是最脆弱的一点,因为我觉得我需要设置
uWSGIModifier1 5
在这里但没有弄清楚在哪里以及如何?重新启动 Apache 并得到“内部服务器错误”。在 uwsgi 日志中,我只看到:
Tue Jan 19 02:10:36 2016 - spawned uWSGI worker 1 (pid: 21712, cores: 1)
Tue Jan 19 02:10:56 2016 - -- unavailable modifier requested: 0 --
Tue Jan 19 02:24:44 2016 - -- unavailable modifier requested: 0 --
Tue Jan 19 02:27:14 2016 - -- unavailable modifier requested: 0 --
Tue Jan 19 02:27:17 2016 - -- unavailable modifier requested: 0 --
这个“请求的修饰符不可用”是什么?
在 apache error.log 中没有条目,在 access.log 中有条目,但除了状态 500 之外没有其他信息。
这种行为可以通过上述步骤重现,所以我希望你弄清楚,这种组合有什么问题?
最佳答案
I feel like I need to set
uWSGIModifier1 5
here but did not figured out where and how?
你是对的。您应该将modifier1 设置为5,但是uwsgi docs关于 mod_proxy_uwsgi 说:
Currently the module lacks the ability to set modifiers, though this will be fixed soon.
这意味着,您不能使用此方法将修饰符传递给 uWSGI 实例(如果未提供,uWSGI 将使用修饰符 0)
要解决该问题,您可以移至 mod_uwsgi或更改加载 psgi 的修饰符,使用:
plugins = 0:psgi
代替
plugins = psgi
关于apache - 为什么 Dancer 应用在 uWSGI + Apache 下失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34866724/