Hướng dẫn cài đặt HTTP/2 trên DirectAdmin

24
0

Hướng dẫn cài đặt HTTP/2 trên DirectAdmin với 4 bước

Hướng dẫn cài đặt HTTP/2 trên DirectAdmin

HTTP/2 là phiên bản chính thức tiếp theo của giao thức HTTP, nhằm cải thiện tốc độ tải web. Nó được bắt nguồn từ giao thức SPDY thử nghiệm trước đó, do Google phát triển ban đầu.

Bươc 1: Cài đặt OpenSSL, cùng ALPN

DOTRUNGQUAN.INFO
wget https://www.openssl.org/source/old/1.0.2/openssl-1.0.2u.tar.gz
tar xzf openssl-1.0.2u.tar.gz
cd openssl-1.0.2u
./config --prefix=/usr/local/lib_http2 no-ssl2 no-ssl3 zlib-dynamic -fPIC
make depend
make install
    

Bước 2: Cài đặt nghttp2

DOTRUNGQUAN.INFO
cd /usr/local/directadmin/custombuild
./build update
./build nghttp2
    

Bước 3: Kích hoạt http2 cho Apache

DOTRUNGQUAN.INFO
cd /usr/local/directadmin/custombuild
mkdir -p custom/ap2
cp -p configure/ap2/configure.apache custom/ap2/configure.apache
    

Sau đó bạn tìm và mở file custom/ap2/configure.apache. Và tìm đến dòng "--with-ssl=/usr" . Sau đó thêm vào đoạn sau

"--enable-http2" 
"--enable-ssl-staticlib-deps" 
"--with-ssl=/usr/local/lib_http2" 

Bước 4: Build lại apache và cho apache chạy http2

DOTRUNGQUAN.INFO
./build apache
echo 'ProtocolsHonorOrder On' >> /etc/httpd/conf/extra/httpd-includes.conf
echo 'Protocols h2 h2c http/1.1' >> /etc/httpd/conf/extra/httpd-includes.conf
    

Bước 5: Cập nhật lại SSL Ciphers

Bạn hãy cập nhật lại SSL Ciphers tại file /etc/httpd/conf/extra/httpd-ssl.conf như sau.

DOTRUNGQUAN.INFO
cd /usr/local/directadmin/custombuild
./build rewrite_confs
    

Kích hoạt HTTP/2 trong cURL. Bạn hãy mở file /usr/local/directadmin/custombuild/custom/curl/configure.curl và thêm đoạn code sau

#!/bin/sh
perl -pi -e 's|CURL_CHECK_PKGCONFIG(zlib)|#CURL_CHECK_PKGCONFIG(zlib)|g' configure.ac
LIBS="-ldl" ./configure --with-nghttp2=/usr/local --with-ssl=/usr/local/lib_http2

Bây giờ bạn hãy Build lại curl

DOTRUNGQUAN.INFO
cd /usr/local/directadmin/custombuild
chmod 700 custom/curl/configure.curl
./build curl
    

Như vậy là đã hoàn tất Hướng dẫn cài đặt HTTP/2 trên DirectAdmin. Chúc bạn thực hiện thành công.

Đỗ Trung Quân
WRITTEN BY

Đỗ Trung Quân

Nguồn nội dung này đến từ Website DoTrungQuan.info

Trả lời