2012-05-29 121 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