使用uwsgi部署机架应用程序无法找到应用程序

时间:2012-05-29 15:51:20

标签: ruby uwsgi

我们正在使用uWSGI来部署多个python应用程序。我们希望使用uWSGI来提供我们的ruby机架应用程序。经过很多努力让uWSGI使用bundler来获取应用程序(最终我需要将bundle装入bundle本身),我终于让uWSGI拿起了应用程序。我使用以下配置:

[uwsgi]
socket=/tmp/gearbox.sock
master=true
processes=1
post-buffering=4096
env=GEM_PATH=
env=GEM_HOME=/gearbox/vendor/ruby/1.8
uid=vagrant
gid=vagrant
rack=./config.ru
ruby-gc-freq=10
chdir=/gearbox
env=BUNDLE_GEMFILE=/gearbox/Gemfile

我的nginx配置非常简单:

location / {
            include uwsgi_params;
            uwsgi_param SCRIPT_NAME /gearbox/config.ru;
            uwsgi_pass unix:///tmp/gearbox.sock;
}

我通过以下方式发布:uwsgi -i / apps / uwsgi / gearbox

启动输出如下所示:

[uWSGI] getting INI configuration from /apps/uwsgi/gearbox.ini
*** Starting uWSGI 1.2.3 (64bit) on [Tue May 29 15:46:15 2012] ***
compiled with version: 4.6.3 on 29 May 2012 15:44:06
detected number of CPU cores: 2
current working directory: /gearbox
*** running under screen session 5093.pts-0.precise ***
detected binary path: /usr/local/bin/uwsgi
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
uwsgi socket 0 bound to UNIX address /tmp/gearbox.sock fd 3 
Python version: 2.7.3 (default, Apr 20 2012, 23:04:22)  [GCC 4.6.3]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x17feb20
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
your server socket listen backlog is limited to 100 connections
*** Operational MODE: single process ***
RACK app 0 loaded in 1 seconds at 0x1591 (GC frequency: 10)
spawned uWSGI master process (pid: 10035)
spawned uWSGI worker 1 (pid: 10036, cores: 1)

所以,这对我来说很好看。但是,当我尝试连接到应用程序(通过nginx)时,我收到:

vagrant@precise:~$ curl localhost
<h1>uWSGI Error</h1>Python application not foundvagrant@precise:~$

我很困惑,因为看起来我配置正确。任何想法都会非常感激。

由于

1 个答案:

答案 0 :(得分:1)

您错过了在nginx配置中设置uwsgi_modifier1(并删除了SCRIPT_NAME设置)

如果您想以“智能”方式使用bundler,只需添加:

即可
rbrequire = rubygems
rbrequire = bundler/setup

没有搞乱GEM_PATH / GEM_HOME环境变量