0

uWSGIを使用して、いくつかのPythonアプリケーションをデプロイしています。uWSGIを使用して、ルビーラックアプリケーションにもサービスを提供したいと考えています。uWSGIがbundlerを使用してアプリケーションを取得するのに苦労した後(最終的には、bundlerをバンドル自体にインストールする必要がありました)、ついに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:~$

私はこれを正しく構成しているように見えるので、私はかなり困惑しています。どんな考えでも大歓迎です。

ありがとう

4

1 に答える 1

1

nginx configでuwsgi_modifier1を設定し忘れました(そしてSCRIPT_NAME設定を削除しました)

「スマート」な方法でバンドラーを使用したい場合は、次を追加するだけです。

rbrequire = rubygems
rbrequire = bundler/setup

GEM_PATH/GEM_HOME環境変数をいじることなく

于 2012-05-29T16:12:58.537 に答える