5
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

posted at

Organization

【nginx】バージョンアップ方法

nginxのバージョンアップ。
今のバージョンファイルを上書きすることなくシンボリックリンクで向き先を変えるやり方。

現在のバージョンチェック

# /usr/local/nginx/sbin/nginx -v
 nginx version: nginx/1.5.8

ソースダウンロード解凍

# cd /usr/local/src
# wget http://nginx.org/download/nginx-1.9.14.tar.gz  
# tar xvf nginx-1.9.14.tar.gz
# cd nginx-1.9.14

インストール

# ./configure --prefix=/usr/local/nginx-1.9.14 \
  --user=nginx \
  --group=nginx \
  --with-http_ssl_module \
  --with-http_realip_module \
  --with-http_addition_module \
  --with-http_xslt_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 \
  --add-module=/usr/local/src/headers-more-nginx-module
# make && make install

設定ファイルコピー

# cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx-1.9.14/conf/nginx.conf
# cp /usr/local/nginx/conf/certs.pem /usr/local/nginx-1.9.14/conf/certs.pem
# cp /usr/local/nginx/conf/ssl-oisix.key /usr/local/nginx-1.9.14/conf/ssl-oisix.key
# cp -r /usr/local/nginx/conf/virtualhost /usr/local/nginx-1.9.14/conf/
# chown -R nginx. /usr/local/nginx-1.9.14

シンボリックリンクで切り替え

# ln -nfs /usr/local/nginx-1.9.14 /usr/local/nginx

設定ファイルのシンタックスチェック

# /usr/local/nginx/sbin/nginx -t
 syntax is okを確認

リクエストを落とさずにプロセスを切り替える

# ps aux |grep nginx
masterのプロセスIDを確認
# kill -USR2 5559
# kill -WINCH  5559
# kill -QUIT  5559
# /usr/local/nginx/sbin/nginx -s reload
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
5
Help us understand the problem. What are the problem?