เปิด HTTP/2 สำหรับ DirectAdmin

หลังจากมีการประกาศใช้ิ HTTP/2 และ Cloudflare ก็เปิดใช้ HTTP/2 ฟรี ทำให้ได้รับการตอบรับและเป็นเรื่องที่น่าตื่นเต้นสำหรับการพัฒนาก้าวใหญ่ๆ อีกก้าวบนโลกอินเตอร์

ref : https://blog.restcase.com/http2-benefits-for-rest-apis/

ในบทความนี้เราจะไม่ลงรายละเอียดมากนัก แต่จะขอสรุปคร่าวๆ ให้ฟังถึงประโยชน์ของ HTTP/2 ดังนี้ครับ

  • ทำให้เว็บแสดงผลและตอบสนองได้เร็วขึ้น
  • HTTP/2 + SSL ปลอดภัยกว่า HTTP/1.1 + SSL
  • เพิ่มโอกาสการพัฒนากับ Web Application
  • เว็บที่เหมาะกับกับ HTTP/2 เว็บเว็บที่มีรูปภาพเยอะ เว็บทางธุรกิจ,ธุรกรรม เว็บที่มีการใช้งานระบบ Stremming

1) อัพเกรด OpenSSL

cd ~
wget ftp://ftp.openssl.org/source/openssl-1.1.0h.tar.gz
tar xzf openssl-1.1.0h.tar.gz
cd openssl-1.1.0h
./config --prefix=/usr/local/lib_http2 no-ssl2 no-ssl3 zlib-dynamic -fPIC
make depend
make install

2) ติดตั้ง nghttp2

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

3) เปิด HTTP/2 บน Apache

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

แก้ไขไฟล์ /usr/local/directadmin/custombuild/custom/ap2/configure.apache

ค้นหา "--with-ssl=/usr" \

แทนที่ด้วย

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

หลังจากนั้น rebuild Apache

./build apache

4)  Apache configuration

เพิ่มโค้ดด้านล่างนี้ลงในไฟล์ /etc/httpd/conf/extra/httpd-includes.conf

ProtocolsHonorOrder On
Protocols h2 h2c http/1.1

ทำการ rebuild apache

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

5) Reboot the server

Was this article helpful?

Related Articles