我们正在使用 uWSGI 来部署几个 python 应用程序。我们想使用 uWSGI 来服务于我们的 ruby rack 应用程序。在努力让 uWSGI 使用 bundler 获取应用程序之后(最终我需要将 bundler 安装到 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:~$
我很困惑,因为似乎我的配置正确。任何想法将不胜感激。
谢谢