How to install HTTP/2 on DirectAdmin

Install OpenSSL with ALPN support

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

Install nghttp2 - HTTP/2 Library

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

​Install HTTP/2 for Apache 2.x

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

### REPLACE "--with-ssl=/usr" \
### WITH:

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


### Rebuild apache

./build apache

### Add HTTP/2 settings to httpd-includes.conf

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

### Set PHP to use PHP-FPM

./build set php1_mode php-fpm
./build set mod_ruid2 no
./build apache && ./build php -n && ./build rewrite_confs

Add HTTP/2 to cURL

mkdir -p /usr/local/directadmin/custombuild/custom/curl/
vi /usr/local/directadmin/custombuild/custom/curl/configure.curl

### ADD the following:

#!/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

### BUILD CURL

chmod 700 custom/curl/configure.curl
./build curl

And... we're done...

Source: http://forum.directadmin.com/showthread.php?t=52590

Tags: DirectAdmin Linux http2 http/2