CentrioHost Blog

Stories and News from IT Industry, Reviews & Tips | Technology Blog


How to enable ALPN with http2 for nginx on Centos 7 cPnginx Server

What Is ALPN?

ALPN, or Application-Layer Protocol Negotiation, is a TLS extension that includes the protocol negotiation within the exchange of hello messages. ALPN is able to negotiate which protocol should be handled over a secure connection in a way that is more efficient and avoids additional round trips. The ever-growing in popularity HTTP/2 protocol, makes use of ALPN to further decrease website load times and encrypt connections faster.

Why it is not supported in Centos 7?

The centos 7 is not using the latest openssl package . This the reason behind failing ALPN support with nginx in Centos 7.

Do I need ALPN with HTTP2 ?

The ALPN enabled nginx is more faster than normal http2. So it is better to enable ALPN in your server .

Steps To Enable ALPN with nginx on Centos 7

Please make sure that you are running the latest version of cpnginx software . You need to download the latest openssl packages from https://www.openssl.org/ as follows

cd /usr/local/src/
wget https://www.openssl.org/source/openssl-1.0.2j.tar.gz
tar -xzf openssl-1.0.2j.tar.gz 
mkdir -pv /opt/cpnginx/openssl
cp -vrf openssl-1.0.2j/* /opt/cpnginx/openssl/

Now make a custom nginx build configure as follows,

cp -vf /etc/cpnginx/build/configure.sh /etc/cpnginx/build/custom/	

Now edit the file /etc/cpnginx/build/custom/configure.sh and add the options –with-openssl=/opt/cpnginx/openssl

#!/bin/bash
./configure --prefix=/usr/local/nginx 
        --with-http_ssl_module 
        --with-http_ssl_module 
        --with-http_v2_module 
        --with-http_realip_module 
        --with-http_flv_module 
        --with-http_mp4_module 
        --with-ipv6 
        --with-openssl=/opt/cpnginx/openssl 
        --with-http_stub_status_module 

Now build the nginx software

# nginxctl build nginx --version 1.10.2

Thats it . You have now cpnginx with full ALPN support with http2.

How to test it ?

You can check it from https://tools.keycdn.com/http2-test

Test to see if you browser is getting http2 support . You need to open your https websites on Chrome browser and do an inspect by right clicking your mouse. Now you see as “h2” in protocol section . Please see a sample screen short below,

Subscribe Now

10,000 successful online businessmen like to have our content directly delivered to their inbox. Subscribe to our newsletter!

Archive Calendar

SatSunMonTueWedThuFri
 1
2345678
9101112131415
16171819202122
23242526272829
30 

Over 20000 Satisfied Customers!

  • web hosting reviewer
    Valerie Quinn
    CTO, Acteon Group

    Centriohost staff were fantastic, I had a concern with a domain and they got back to me very quickly and they helped me to resolve the issue! ~ . . . Read more

  • Joomla hosting reviewer
    Collin Bryan
    Photographer, Allister Freeman

    I'm using centrio for my portfolio since 2006. The transition was seamless, the support was immediate, and everything works perfectly. ~ . . . Read more

  • dedicated server reviewer
    Harry Collett
    Actor, A&J Artists

    Very easy to understand & use even though I am not very technologically minded. No complications whatsoever & I wouldn't hesitate to recommend it to all. ~ . . . Read more

  • vps web hosting reviewer
    Porfirio Santos
    Technician, Diageo PLC

    Centrio support team have been amazingly responsive and helpful to any of my queries, thank you so much to the Centriohost have been amazingly responsive and helpful to any of my queries 👍👍👍 ~ . . . Read more

  • wordpress hosting plans reviewer
    Catherine Auer
    Doctor, SmartClinics

    Anytime I've had a problem I can't solve, I've found Centriohost to be diligent and persistent. They simply won't let an issue go until the client is happy. ~ . . . Read more

  • reseller hosting reviewer
    Effectivo Social
    Freelancer, Fiverr

    Recommend their shared hosting for all my SME web design clients. Their cloud or VME offerings are too great to deal with. Pricing is perfect and suitable for all users (͠≖ ͜ʖ͠≖) 👌 ~ . . . Read more

Top