さくらVPSのFreeBSDにsudoとnginxを入れるメモ
前回の さくらのVPS にFreeBSDをインストール… でさくらの VPS に FreeBSD が入ったので続きで sudo と vim と nginx をインストールする。
- port を使って sudo をインストールする
ユーザーはrootで
# cd /usr/ports/security/sudo
# make clean
# make install
# visudo で編集 user ALL=(ALL) ALL を追加する - ports を使って vim をインストールする
ユーザーはrootで
# cd /usr/ports/editors/vim
# make install
何かめちゃくちゃ時間がかかると思ったら、Perl や Python まで入れている - ports を使って nginx をインストールする
ユーザーはrootで
# cd /usr/ports/www/nginx
# make install
テスト的に nginx を動かす
# /usr/local/etc/rc.d/nginx onestart起動したら常にnginx を動かすため
# vi /etc/rc.conf で編集 nginx_enable=”YES”; を追加する
# /usr/local/etc/rc.d/nginx start ← 起動
# /usr/local/etc/rc.d/nginx stop ← 停止
# /usr/local/etc/rc.d/nginx restart ← 再起動
# /usr/local/etc/rc.d/nginx status ← 状態表示# nginx -V で情報が表示されるので、
設定ファイルが /usr/local/etc/nginx/nginx.conf であり、
ドキュメントルートが /usr/local/www/nginx であることが分かる
/usr/local/etc/nginx/nginx.conf の ドキュメントルートを/usr/local/www に変更し
/usr/local/wwwに置いた index.html が表示できたら静的な nginx 動作はOK。「nginx の設定を変更したら # nginx -t でテストしてから nginx を再起動しなさい」と書籍に書いてあった。