nginx + uWSGI for Raspberry pi
nginx も uWSGI も現時点の最新版(2014/06/01)を使います。
nginx 1.6.0
uWSGI 2.0.4 (32bit)
apt-get
でさらっとインストールすると
超古いバージョンが入ってしましました。
最新版を入れてみたい人はこちらを参考にしてください。
インストール
nginx 1.6.0
/etc/apt/sources.list
deb http://nginx.org/packages/debian/ wheezy nginx deb-src http://nginx.org/packages/debian/ wheezy nginx
2行を追記。
コマンド実行
$ sudo apt-get update
$ sudo apt-get build-dep nginx
$ sudo apt-get source nginx
$ cd nginx-1.6.0
$ sudo dpkg-buildpackage -uc -b
$ sudo dpkg -i nginx_1.6.0-1~wheezy_armhf.deb
参考: http://mkws.blogspot.jp/2013/10/nginx-raspberry-pi.html
uwsgi 2.0.4 インストール
$ sudo pip install uwsgi
参考: http://uwsgi-docs.readthedocs.org/en/latest/Install.html
各設定
/etc/nginx/conf.d/default.conf
server { listen 80; server_name localhost; location /hello { include uwsgi_params; uwsgi_pass 127.0.0.1:9090; } }
/etc/uwsgi/apps-available/hello.ini
[uwsgi] socket = 127.0.0.1:9090 enable-threads = true single-interpreter = true master = true process = 2 uid = nginx gid = nginx pythonpath = /usr/share/nginx/html module = hello daemonize = /var/log/uwsgi/access.log
/etc/uwsgi/apps-enabled
$ ln -s ../apps-available/hello.ini
/usr/share/nginx/html/hello.py
import uwsgi def myapp(environ, start_response): start_response('200 OK', [('Content-Type', 'text/plain')]) yield 'Hello uWSGI World\n' uwsgi.applications = { '': myapp }
是非お試しあれ
- 出版社/メーカー: RS Components Ltd (ソースマーキング及び販売 Umemoto LLP)
- メディア: エレクトロニクス
- この商品を含むブログ (12件) を見る
- 作者: Eben Upton,Gareth Halfacree,株式会社クイープ
- 出版社/メーカー: インプレスジャパン
- 発売日: 2013/03/15
- メディア: 単行本(ソフトカバー)
- 購入: 2人 クリック: 21回
- この商品を含むブログ (9件) を見る
ハック ラズベリーパイ Raspberry Pi 電子工作入門キット。
- 出版社/メーカー: iteadstudio
- メディア: エレクトロニクス
- この商品を含むブログを見る