ぽよメモ

レガシーシステム考古学専攻

Nginxの最新版を入れる

ようやくドメインを取得し、ラズパイをもう一台手に入れたので、こいつでWordpressを動かし、このブログをそっちにお引越ししたいと考えています。 ApacheにするかlighttpdにするかNginxにするか悩みましたが、どうも調べた限りではNginxがもっとも軽そうなのでこいつにします。

$ sudo apt-get install nginx php5 mysql-server php5-fpm php5-mysql phpmyadmin chkconfig
#勝手に入ってくるapache2を切る
$ sudo chkconfig apache2 off 

しかし、ここで入れたnginxのバージョンは1.2.1でした。
最新版は1.8.0です。ちょっと気持ち悪いので手動で入れなおそうと思います。

#nginxのアンインストール
$ sudo apt-get remove nginx
#Nginxのリポジトリ追加
$ echo 'deb-src http://nginx.org/packages/debian/ wheezy nginx' | sudo tee -a /etc/apt/sources.list
#PGP公開キーを登録
$ wget http://nginx.org/keys/nginx_signing.key -O - | sudo apt-key add -
#GnuPGに登録
$ wget http://nginx.org/keys/nginx_signing.key -O - | gpg --no-default-keyring --keyring ~/.gnupg/trustedkeys.gpg --import -

/tmp/nginxにソースパッケージを展開しコンパイルします。

$ sudo apt-get update
$ sudo apt-get build-dep nginx
$ mkdir /tmp/nginx
$ cd /tmp/nginx
$ sudo apt-get source nginx
$ cd nginx-*
$ dpkg-buildpackage -uc -b
$ cd ..
#インストール
$ dpkg -i nginx_*~wheezy_armhf.deb

最後のインストールになってエラーが出ました。 nginx-debが何か悪さしてるっぽい?よくわからない。 言われるままにコマンドを打つ。依存関係の解消をするコマンドらしい。

$ sudo apt-get -f install

これでもまだエラーが出る。今度はnginx-commonが妨害しているようだ。
さらに、ここでまだnginxが動いていることに気づく。

$ sudo service nginx stop
$ sudo apt-get remove nginx-common

もう一度インストールを試す

$ dpkg -i nginx_*~wheezy_armhf.deb
(Reading database ... 82645 files and directories currently installed.)
Unpacking nginx (from nginx_1.8.0-1~wheezy_armhf.deb) ...
----------------------------------------------------------------------
Thanks for using nginx!
Please find the official documentation for nginx here:
* http://nginx.org/en/docs/
Commercial subscriptions for nginx are available on:
* http://nginx.com/products/
----------------------------------------------------------------------
Setting up nginx (1.8.0-1~wheezy) ...
Installing new version of config file /etc/nginx/scgi_params ...
Installing new version of config file /etc/nginx/fastcgi_params ...
Installing new version of config file /etc/nginx/koi-win ...
Installing new version of config file /etc/nginx/nginx.conf ...
Installing new version of config file /etc/nginx/koi-utf ...
Installing new version of config file /etc/nginx/win-utf ...
Installing new version of config file /etc/nginx/uwsgi_params ...
Installing new version of config file /etc/nginx/mime.types ...
Installing new version of config file /etc/init.d/nginx ...
Installing new version of config file /etc/logrotate.d/nginx ...
Installing new version of config file /etc/default/nginx ...
$nginx -v
nginx version: nginx/1.8.0

上手くいった。やったね。
冬休み中に設定を終えてしまいたいですね…