CentOS 6 で nginx にて TLSv1.3 にする。(とにかく tar.gz を使って yum で動かしたときのメモ)
対象となるのはすでに nginx をインストールしている方だと思います。 あと、自己責任でお願いします。
(1)ビルドするためのツールをインストール
$ sudo yum install gcc pcre-devel perl zlib-devel
(2)OpenSSL のダウンロード(2019/10/06現在のOpenSSLの最新版は1.1.1d)
$ cd /usr/local/src/ $ sudo curl -O https://www.openssl.org/source/openssl-1.1.1d.tar.gz $ sudo tar fxz openssl-1.1.1d.tar.gz
(3)nginx のダウンロードとインストール(2019/10/06現在のnginxの最新版は1.16.1)
$ sudo curl -O https://nginx.org/download/nginx-1.16.1.tar.gz $ sudo tar fxz nginx-1.16.1.tar.gz $ cd nginx-1.16.1 # 下のconfigure は自分の設定しているものを突っ込んでください。 # 今現在 nginx を使っているなら $ nginx -V で確認することができます。 # ただし、--with-openssl の値は /usr/local/src/openssl-1.1.1d にしてください。 $ sudo ./configure --with-http_ssl_module --with-openssl=/usr/local/src/openssl-1.1.1d --add-module=/root/./incubator-pagespeed-ngx-latest-stable --with-cc=/opt/rh/devtoolset-2/root/usr/bin/gcc --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --without-http_userid_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-http_v2_module --with-http_gzip_static_module --with-http_gunzip_module --with-mail_ssl_module $ sudo make $ sudo make install
(4) nginx: Linux packages に書かれているようにする。
4-1$ sudo yum install yum-utils
4-2$ vim /etc/yum.repos.d/nginx.repo
で以下のコードに差し替える(念の為、もともとのやつは「#」のコメントアウトで残して置くのが吉かと思います)。
[nginx-stable] name=nginx stable repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true [nginx-mainline] name=nginx mainline repo baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/ gpgcheck=1 enabled=0 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true
4-3$ sudo yum-config-manager --enable nginx-mainline
でメインラインの nginx 使います宣言します。
4-4 $ sudo yum install nginx
で nginx をインストールするフリをします。
(5)nginx の設定ファイル(*.conf)にある 「TLSv1.1 TLSv1.2」と書かれている箇所を「TLSv1.2 TLSv1.3」などのように書き換える。 上述したTLSv1.1などがない場合は他のサイトにある SSL のインストールの仕方や nginx での設定の仕方などを見てください。
(6)nginx を再起動する。
$ service nginx restart
(7)バージョンを確認
$ nginx -V
ここに
nginx version: nginx/1.16.1 built by gcc 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC) built with OpenSSL 1.1.1d 10 Sep 2019 TLS SNI support enabled configure arguments: --with-http_ssl_module --with-openssl=/usr/local/src/openssl-1.1.1d --add-modu(略)
とあるように、nginx/1.16.1や OpenSSL 1.1.1d と書かれている箇所があれば OK。
(8)Chrome にて確認する。 [DevTools]を開いて[Security]の項目を確認し、"TLS 1.3"となっていれば TLS 1.3 での接続になっています。