13
13

More than 5 years have passed since last update.

【raspberry-pi】nginx + passenger + node.js 環境作成メモ (1)

Last updated at Posted at 2014-02-20

raspi_rainbow.jpg

環境

  • 256MB版 Raspberry Pi (raspbian)
  • nginx/1.4.4 + Phusion Passenger 4.0.37
  • node.js v0.10.21

swapを増やす

  • 1G程度ないとpassengerのnginxモジュールビルドで失敗する。
$ sudoedit /etc/dphys-swapfile
CONF_SWAPSIZE=1000
$ sudo service dphys-swapfile stop
$ sudo service dphys-swapfile start
$ free -h

rbenv インストール

githubから取ってくる

$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv

.bashrc追記

.bashrc
#rbenv
export PATH=$HOME/.rbenv/bin:$PATH
eval "$(rbenv init -)"

確認

$ source .bashrc
$ rbenv -v
rbenv 0.4.0-89-g14bc162

ruby インストール

インストールできるバージョンを表示

$ rbenv install -l

インストール(今回は2.0.0にした)

$ rbenv install -v 2.0.0-p353
$ rbenv rehash

使用するrubyを設定、確認

$ rbenv global 2.0.0-p353
$ rbenv global
2.0.0-p353
$ ruby -v
ruby 2.0.0p353 (2013-11-22 revision 43784) [armv6l-linux-eabihf]

passenger インストール

$ gem install passenger

passenger-nginx-module インストール

  • nginxもここでインストールした
  • 途中の選択は「node.js」を選んだ
  • インストール先は /opt/nginx のまま
$ export ORG_PATH="$PATH"
$ sudo -s -E
# export PATH="$ORG_PATH"
# passenger-install-nginx-module

nginxの起動スクリプト

  • debianadminから取ってきて /etc/init.d に置く
  • 修正(/usr/local/nginx になってるところを /opt/nginx に置換)

nginxの自動起動

$ sudo update-rc.d nginx defaults
$ sudo sysv-rc-conf -list | grep nginx
nginx        0:off      1:off   2:on    3:on    4:on    5:on    6:off

確認

$ sudo service nginx start
$ sudo service nginx stop

続き

参考

13
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
13