ホームページ  >  記事  >  運用・保守  >  Nginxサービスのインストールとソフトウェアのアップグレード方法

Nginxサービスのインストールとソフトウェアのアップグレード方法

WBOY
WBOY転載
2023-05-23 16:55:061355ブラウズ

実験環境:

[root@nginx ~]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 
[root@nginx ~]# uname -r
3.10.0-693.el7.x86_64

低バージョンの Nginx サーバーの準備

低バージョン環境のインストールを参照してください:

0 初心者でも完了できる基本的な Nginx サービスの導入

新しいバージョンの Nginx ソフトウェアを準備してコンパイルする

古いバージョンの Nginx を表示する:

[root@nginx nginx-1.10.3]# /app/nginx/sbin/nginx -V
nginx version: nginx/1.8.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --user=nginx --group=nginx --prefix=/app/nginx-1.8.1/ --with-http_stub_status_module --with-http_ssl_module

新しいバージョンの Nginx サービス ソフトウェアをダウンロードする:

[root@nginx ~]# wget -q http://nginx.org/download/nginx-1.10.3.tar.gz

解凍してディレクトリに入力します:

[root@nginx tools]# tar xf nginx-1.10.3.tar.gz 
[root@nginx tools]# cd nginx-1.10.3/

プリコンパイルしてコンパイルします:

[root@nginx nginx-1.10.3]# ./configure --user=nginx --group=nginx --prefix=/app/nginx-1.8.1/ --with-http_stub_status_module --with-http_ssl_module
[root@nginx nginx-1.10.3]# make

古いバージョンを新しいバージョンに置き換えます

古いバージョンの実行可能ファイルをバックアップします:

[root@nginx ~]# mv /app/nginx/sbin/nginx /app/nginx/sbin/nginx.old
[root@nginx nginx-1.10.3]# cp objs/nginx /app/nginx/sbin/

新しいバージョンが正常かどうかを確認します:

[root@nginx ~]# /app/nginx/sbin/nginx -t
nginx: the configuration file /app/nginx-1.8.1//conf/nginx.conf syntax is ok
nginx: configuration file /app/nginx-1.8.1//conf/nginx.conf test is successful

グレースフル リスタートを実行してバージョンを確認します:

[root@nginx ~]# /app/nginx/sbin/nginx -s reload
[root@nginx ~]# /app/nginx/sbin/nginx -V
nginx version: nginx/1.10.3
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --user=nginx --group=nginx --prefix=/app/nginx-1.8.1/ --with-http_stub_status_module --with-http_ssl_module

プロセスを確認します:

[root@nginx ~]# ps -ef | grep nginx
root       9003      1  0 10:24 ?        00:00:00 nginx: master process /app/nginx/sbin/nginx
nginx     11720   9003  0 11:24 ?        00:00:00 nginx: worker process
root      11724   1223  0 11:24 pts/0    00:00:00 grep --color=auto nginx

ポートを確認します:

rree

以上がNginxサービスのインストールとソフトウェアのアップグレード方法の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事はyisu.comで複製されています。侵害がある場合は、admin@php.cn までご連絡ください。