-Ubuntu 12.04.3 LTS で仮想マシンを使用しています
-Uwsgi + nginx で Django プロジェクトを実行
しています -「192.168.33.50 myproject.com」をホスト ファイルに追加
しました -uwsgi + スーパーバイザー + nginx プロセスを開始しました
- myproject.com にアクセスしようとすると、/var/log/nginx/error.log に次のエラーが記録されます。
2013/11/13 07:43:21 [crit] 14741#0: *1 connect() to unix:/tmp/uwsgi_myproject.sock failed (2: そのようなファイルやディレクトリはありません) 上流への接続中に、クライアント: 192.168. 33.1 米ドル
エディション 1
これは私の uwsgi.ini です:
[ウズギ]
モジュール = myproject.wsgi:アプリケーション
マスター ワーカー = 3
logto = /vagrant/log/uwsgi.log
ソケット = /tmp/uwsgi_myproject.sock
pidfile = /tmp/uwsgi_myproject.pid chmod-socket = 666auto-procname need-app バキューム
エディション 2
コンソールでこのコマンドを実行すると:
uwsgi --ini /vagrant/uwsgi.ini --chdir /vagrant/myproject/ --socket /tmp/uwsgi_myproject.sock --pidfile /tmp/myproject.pid
そのコマンドでuwsgiが起動し、myproject.comにアクセスできるのですが、djangoのスーパーバイザーでuwsgiが起動することが想定されます
エディション 3
これは /etc/nginx/conf.d/ の myproject.conf です
サーバー { リッスン 80; 文字セット utf-8; sendfile オフ;
# ONIX files client_max_body_size 100M; location /media/imagen { include uwsgi_params; #The uwsgi_pass must comply with the details in supervisord.conf uwsgi_pass unix:/tmp/uwsgi_myproject.sock; } location /media/resources/protected { root /vagrant/myproject/myproject; internal; } location /media { root /vagrant/myproject/myproject; } location /static { root /vagrant/myproject/myproject; } location / { include uwsgi_params; #The uwsgi_pass must comply with the details in supervisord.conf uwsgi_pass unix:/tmp/uwsgi_myproject.sock; uwsgi_read_timeout 300; }
}
編集済み: @ChrisC による SUPERVISOR.CONF の追加
[supervisord]
logfile={{ PROJECT_DIR }}/../log/supervisord.log
pidfile=/tmp/supervisor_PROJECTNAME.pid
user=PROJECTNAME
environment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8,LC_LANG=en_US.UTF-8
[unix_http_server]
file = /tmp/supervisor_PROJECTNAME.sock
[program:__defaults__]
directory={{ PROJECT_DIR }}
startsecs=5
[program:autoreload]
exclude=true
[program:uwsgi]
command=uwsgi --ini {{ PROJECT_DIR }}/../uwsgi.ini --chdir {{ PROJECT_DIR }} --socket /tmp/uwsgi_PROJECTNAME.sock --pidfile /tmp/uwsgi_PROJECTNAME.pid
stopsignal=INT