NGINX에서 TLSv1.3를 활성화하는 방법은 무엇인가요? VestaCP / CentOS 또는 Ubuntu

이 자습서에서는 방법을 배웁니다. 활성화 TLSNGINX의 v1.3. 무슨 뜻이에요 TLSv 1.3, 무엇이 도움이 되나요? 그리고 왜 당신은 필요 웹 서버에서 다음과 같이 TLS 활성화할 수 있습니다. 관리 시스템이 있는 서버용 VestaCP (CentOS 또는 우분투)가 조금 더 어렵습니다. 활성화 TLS 1.3 cPanel 서버보다 가능하지만 불가능하지는 않습니다.

더 나은 이유 TLS 1.3보다 TLS 1.2?

TLS (Transport Layer Security) 하는 암호화 프로토콜 보장하는 연결 보안 컴퓨터와 컴퓨터가 속한 네트워크 사이. TLS 다음과 같은 애플리케이션에 사용됩니다. 이메일, 메시지, 음성 및 화상 통화 (VoIP), 그러나 특히 HTTPS. 사용자의 컴퓨터 또는 스마트폰과 액세스한 페이지의 웹 서버 간의 보안 통신을 보장합니다.

TLS 1.3 제공합니다 더 빠른 속도 연결 클라이언트 – 서버 및 또한 보안 일부 알고리즘을 제거하여 차이점 TLSv1.2 및 TLSv1.3.

HTTPS, SSL (Secure Sockets Layer) 다른 기사에서도 말했습니다.

NGINX에서 TLS 1.3를 활성화하는 방법은 무엇인가요? VestaCP 관리 서버 / CentOS

활성화 방법을 보기 전에 TLSNGINX의 v1.3에서는 몇 가지 최소 요구 사항을 고려해야 합니다. TLS 1.3.

  1. NGINX 1.13.x 이상
  2. 인증서 TLS 유효한
  3. 적절하게 구성된 DNS가 있는 활성 도메인 이름 – 인터넷에서 액세스 가능
  4. 인증서 TLS / SSL 유효한. 그것은 또한 될 수 있습니다 Let’s Encrypt.

Pe VestaCP 오래 전에 설치되어 프로토콜만 사용할 수 있습니다. TLS 1.2. 나는 많은 튜토리얼에서 다음과 같이 충분하다는 것을 보았습니다. nginx.conf ca에 다음 줄을 추가해 보겠습니다. TLS 1.3 활성화:

server {

  listen 443 ssl http2;
  listen [::]:443 ssl http2;

  server_name example.com;
  root /var/www/example.com/public;

  ssl_certificate /path/to/your/certificate.crt;
  ssl_certificate_key /path/to/your/private.key;

  ssl_protocols TLSv1.2 TLSv1.3;

가짜. 만약에 서버 CentOS 경영진과 함께 VestaCP, NGINX가 컴파일되지 않았습니다. 최소 버전으로 OpenSSL 1.1.1.1, ssl_protocols TLSv1.2 TLSv1.3;nginx.conf .. 전혀 도움이 되지 않습니다.

[root@north ~]# nginx -V
nginx version: nginx/1.22.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled

따라서 위의 예에서 Nginx 1.22.0은 호환 버전입니다. TLS 1.3, 그러나 라이브러리는 우리를 돕지 않습니다 OpenSSL 1.0.2k-fips.

활성화하려면 TLSNginx에서 v1.3을 사용하려면 하위 라이브러리와 개발 패키지를 먼저 설치해야 합니다. Development Tools. 그것은 실행 CentOS 7개의 명령줄:

yum install gcc gcc-c++ pcre-devel zlib-devel make unzip gd-devel perl-ExtUtils-Embed libxslt-devel openssl-devel perl-Test-Simple
yum groupinstall 'Development Tools'

1. 최신 버전 설치 OpenSSL

현재 최신 버전은 OpenSSL 1.1.1p, 하지만 내가 본 바로는 이미 OpenSSL 3. 다음에서 소스를 찾을 수 있습니다. OpenSSL.ORG.

cd /usr/src
wget https://www.openssl.org/source/openssl-1.1.1p.tar.gz
tar xvf openssl-1.1.1p.tar.gz 
mv openssl-1.1.1p openssl
cd openssl
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl --libdir=/lib64 shared zlib-dynamic
make -j4
make test 
make install 

실행하는 것이 매우 중요합니다. make test 라이브러리를 설치하기 전에. 테스트에 오류가 있으면 실행하지 마십시오. make install 오류가 수정될 때까지.

다음 단계에서는 현재 바이너리 파일을 백업합니다. openssl 그리고 우리는 추가 symlink 새로운 것에.

mv /usr/bin/openssl /usr/bin/openssl-backup
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl

에서 /usr/local/openssl/bin 실행하다 ldd 의존성을 확인하기 위해 openssl. 버전을 확인할 수도 있습니다. openssl. 명령 openssl version.

[root@north bin]# ldd openssl
	linux-vdso.so.1 =>  (0x00007ffd20bd7000)
	libssl.so.1.1 => /lib64/libssl.so.1.1 (0x00007fab09b62000)
	libcrypto.so.1.1 => /lib64/libcrypto.so.1.1 (0x00007fab09675000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007fab09471000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fab09255000)
	libc.so.6 => /lib64/libc.so.6 (0x00007fab08e87000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fab09df5000)
[root@north bin]# openssl version
OpenSSL 1.1.1p  21 Jun 2022

현재 최신 버전이 설치되어 있습니다. OpenSSL 견디는 TLSv1.3. 버전을 확인할 수 있습니다. TLS / SSL 서점에서 지원 OpenSSL 주문으로:

[root@north bin]# openssl ciphers -v | awk '{print $2}' | sort | uniq
SSLv3
TLSv1
TLSv1.2
TLSv1.3
[root@north bin]# 

이것은 관리자의 도움으로 호스팅되는 웹 사이트를 의미하지는 않습니다. VestaCP 그들은 즉시 가질 것입니다 TLS 1.3.

우리가 설치했지만 OpenSSL 1.1.1p, Nginx는 이전 버전으로 컴파일됩니다. OpenSSL 1.0.2k-fips.

[root@north bin]# nginx -V
nginx version: nginx/1.22.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'
[root@north bin]# openssl version
OpenSSL 1.1.1p  21 Jun 2022
[root@north bin]# 

2. 시스템용 Nginx 재컴파일 VestaCP

이 단계에서는 다음을 위해 다시 컴파일해야 합니다. OpenSSL 이미 설치된 Nginx 버전 시스템에서 CentOS / VestaCP. 위에서 말했듯이 제 경우는 nginx/1.22.0. 우리는 웹 서버에 대해 이야기하고 있기 때문에 VestaCP 다시 컴파일을 시작하기 전에 nginx 구성 파일을 백업하는 것이 좋습니다.

시스템의 Nginx 현재 백업 VestaCP

"/etc/nginx"와"/usr/local/vesta/nginx".

달리다 nginx -V 기존 모듈을 파일에 저장합니다.

configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'
어떻게 활성화합니까? TLSNGINX의 v1.3
활성화하는 방법 TLSNGINX의 v1.3

업그레이드를 위해 Nginx를 다시 컴파일하는 방법 OpenSSL / CentOS 7

다시 한번 말한다. 당신이 가지고 있다면 VestaCP, 이미 설치한 Nginx 버전을 다운로드합니다. 다음에서 Nginx 버전이 있는 모든 아카이브를 찾을 수 있습니다. nginx.org.

cd /usr/src
wget https://nginx.org/download/nginx-1.22.0.tar.gz 
tar xvf nginx-1.22.0.tar.gz
cd nginx-1.22.0

nginx 모듈을 다시 컴파일합니다.

./configure --prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \ 
--modules-path=/usr/lib64/nginx/modules \ 
--conf-path=/etc/nginx/nginx.conf \ 
--error-log-path=/var/log/nginx/error.log  \
--http-log-path=/var/log/nginx/access.log  \
--pid-path=/var/run/nginx.pid  \
--lock-path=/var/run/nginx.lock  \
--http-client-body-temp-path=/var/cache/nginx/client_temp  \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp  \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp  \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp  \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp  \
--user=nginx  \
--group=nginx  \
--with-compat  \
--with-file-aio  \
--with-threads  \
--with-http_addition_module  \
--with-http_auth_request_module  \
--with-http_dav_module  \
--with-http_flv_module  \
--with-http_gunzip_module  \
--with-http_gzip_static_module  \
--with-http_mp4_module  \
--with-http_random_index_module  \
--with-http_realip_module  \
--with-http_secure_link_module  \
--with-http_slice_module  \
--with-http_ssl_module  \
--with-http_stub_status_module  \
--with-http_sub_module  \
--with-http_v2_module  \
--with-mail  \
--with-mail_ssl_module  \
--with-stream  \
--with-stream_realip_module  \
--with-stream_ssl_module  \
--with-stream_ssl_preread_module  \
--with-openssl=/usr/src/openssl  \
--with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong  \
--param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC'  \
--with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'
make -j4
make install

이제 Nginx가 최신 버전으로 설치되고 컴파일되었습니다. OpenSSL 견딜 수 있는 TLSv1.3.

[root@north bin]# nginx -V
nginx version: nginx/1.22.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
built with OpenSSL 1.1.1p  21 Jun 2022
TLS SNI support enabled

* nginx가 서버에 이미 설치되어 있으면 제거해야 합니다. nginx 업그레이드에서 컴파일이 작동하지 않습니다.

VestaCP에서 도메인을 위해 TLSv1.3를 활성화하는 방법은 무엇인가요?

파일에서 /etc/nginx/nginx.conf 다음 줄을 추가합니다.

ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';

도메인 수준에서 템플릿에서 무언가를 변경했습니다. VestaCP HTTP/2를 활성화하려면. 따라서 Let's Encrypt가 활성화된 새 도메인(example.com)을 추가할 때 다음 구성 파일이 있습니다. SSL:

cat /home/vestacpuser/conf/web/example.com.nginx.ssl.conf 

server {
    listen      IP.IP.IP.IP:443 ssl http2;
    server_name example.com www.example.com;
    root        /home/vestacpuser/web/example.com/public_html;
    index       index.php index.html index.htm;
    access_log  /var/log/nginx/domains/example.com.log combined;
    access_log  /var/log/nginx/domains/example.com.bytes bytes;
    error_log   /var/log/nginx/domains/example.com.error.log error;

    ssl_certificate      /home/vestacpuser/conf/web/ssl.example.com.pem;
    ssl_certificate_key  /home/vestacpuser/conf/web/ssl.example.com.key;

....

ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';

nginx를 다시 시작하기 전에 먼저 구성을 테스트하는 것이 좋습니다.

[root@north web]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@north web]# systemctl restart nginx

이 튜토리얼이 도움이 되기를 바라며 문제가 있는 경우 의견에 문제 세부 정보를 남겨주세요.

기술에 대한 열정, 나는 기쁨으로 글을 씁니다. StealthSettings2006년부터 .com을 운영하고 있습니다. 저는 운영 체제 분야에서 폭넓은 경험을 갖고 있습니다. macOS, Windows 과 Linux, 프로그래밍 언어 및 블로그 플랫폼(WordPress) 및 온라인 상점의 경우(WooCommerce, 마젠토, 프레스타샵).

방법 » Linux » NGINX에서 TLSv1.3를 활성화하는 방법은 무엇인가요? VestaCP / CentOS 또는 Ubuntu
코멘트 남김