2012-05-29 79 views
0

我们正在使用uWSGI部署多个python应用程序。我们希望使用uWSGI来服务我们的红宝石机架应用程序。经过很多努力让uWSGI使用bundler来获取应用程序(最终我需要将bundler安装到捆绑包本身中)后,我终于得到了uWSGI来接收应用程序。我使用了以下配置:使用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 /应用/ uwsgi /变速箱

启动输出看起来像这样:

[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的),我得到:

[email protected]:~$ curl localhost 
<h1>uWSGI Error</h1>Python application not [email protected]:~$ 

我很困惑,因为它似乎我有这个配置权。任何想法将不胜感激。

感谢

回答

1

你已经错过了设置在nginx的配置的uwsgi_modifier1(和删除SCRIPT_NAME设置)

如果你想在“智能”的方式来使用打包器,你可以简单地添加:

rbrequire = rubygems 
rbrequire = bundler/setup 

没有搞乱GEM_PATH/GEM_HOME环境变量

+0

感谢您的快速回复。我更新了我的配置,如下所示: https://gist.github.com/2829459 不幸的是,我得到了同样的结果。有任何想法吗? – turtlebender

+0

0和30是python的修饰符,对于ruby,你可以使用7 http://projects.unbit.it/uwsgi/wiki/uwsgiProtocol – roberto

+0

太棒了。非常感谢。正在运行。如果其他人有类似的问题,我会继续进行博客 – turtlebender