インストール
./configure --user=www-data --group=www-data --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-perl=/usr/bin/perl --prefix=/usr/local/nginx-*.*.*
make
sudo paco -D make install
sudo ln -s /usr/local/nginx-1.0.4 /usr/local/nginx
--userと--groupは設定がないときのみ使用されるデフォルト。
このときのconfigureのオプションは./nginx -V で確認できる。
設定
sudo /usr/local/nginx/conf/nginx.conf
user nobody; # user ユーザネーム グループ に変更。
sudo /usr/local/nginx/sbin/nginx -t
で設定ファイルのチェック。
(本番稼働中に設定ファイルを変更する場合は、-cオプションで別ファイルに設定を作ってからそれをテストする。)
ps aux | grep nginx
でワーカプロセスのユーザネームを確認。問題なければ、アクセスするとWelcome to nginx!が表示されている。
initスクリプト
/etc/init.d/nginxを編集。
DAEMON=/usr/local/nginx/sbin/$NAME
SCRIPTNAME=/etc/init.d/$NAME
元の雛形にstart-stop-daemonがあったが、使用せずに以下を記述
d_start() {
$DAEMON || echo -n " already running"
}
d_stop() {
$DAEMON -s quit || echo -n " not running"
}
d_reload() {
$DAEMON -s reload || echo -n " not reload"
}
を追加して、case "$1" in の start) stop) restart) などで呼び出す。
$update-rc.d -f nginx defaults
でランレベル遷移の際にスクリプト実行されるようにするが、すでに登録されている。
0 件のコメント:
コメントを投稿