Installing and Enabeling HTTP/2 Nginx 1.9.9

theo

Verified User
Joined
Jan 28, 2016
Messages
6
After a lot of searching and trying here the solution to enable http/2 and keeping the settings after shaving HTTP custom and rebuilding configs.

used : https://forum.directadmin.com/archive/index.php/t-51344.html
used : http://nginx.org/en/docs/http/ngx_http_v2_module.html

cd /usr/local/directadmin/custombuild/
mkdir /usr/local/directadmin/custombuild/custom
mkdir /usr/local/directadmin/custombuild/custom/nginx
mkdir /usr/local/directadmin/custombuild/custom/nginx/conf
cp /usr/local/directadmin/custombuild/configure/nginx/configure.nginx /usr/local/directadmin/custombuild/custom/nginx/configure.nginx
cp /usr/local/directadmin/custombuild/configure/nginx/conf/nginx-vhosts.conf /usr/local/directadmin/custombuild/custom/nginx/conf/nginx-vhosts.conf


nano /usr/local/directadmin/custombuild/custom/nginx/configure.nginx

"--with-http_v2_module"

nano /usr/local/directadmin/custombuild/custom/nginx/conf/nginx-vhosts.conf

listen |IP|:|PORT_443| ssl http2;
listen 127.0.0.1:|PORT_443| ssl http2;
listen [::1]:|PORT_443| ssl http2;


+++++++++++

used : http://help.directadmin.com/item.php?id=2

cd /usr/local/directadmin/data/templates
dir custom exists ? mkdir custom
cp /usr/local/directadmin/data/templates/nginx_server_secure.conf /usr/local/directadmin/data/templates/custom/nginx_server_secure.conf
cp /usr/local/directadmin/data/templates/nginx_server_secure_sub.conf /usr/local/directadmin/data/templates/custom/nginx_server_secure_sub.conf


nano /usr/local/directadmin/data/templates/custom/nginx_server_secure.conf

listen |IP|:|PORT_443| ssl http2;


nano /usr/local/directadmin/data/templates/custom/nginx_server_secure_sub.conf

listen |IP|:|PORT_443| ssl http2;


echo "action=rewrite&value=nginx" >> /usr/local/directadmin/data/task.queue
/usr/local/directadmin/dataskq d


cd /usr/local/directadmin/custombuild/
./build nginx
./build rewrite_confs
service nginx restart

..


Feedback welkom I hope it helps.

Greetings Theo
 
Hi,

If we're using Reverse-proxy NGINX + Apache, is it necessary to enable http2 for Apache as well so that Nginx passing request to apache also be http2?
 
Hello,

No, there is no need to enable HTTP/2 in Apache if nginx (with HTTP/2 support) sits in front of it.
 
ALPN not supported ?

Hi, My Centos 6.7 server has custombuild 2 with NGINX as standalone server. I had installed HTTP/2 successfully. Thanks for the guide.

When I checked with https://tools.keycdn.com/http2-test it said "ALPN not supported" - is this true of false ?
If true, then how do I enable ALPN support ?

Thank you
 
What domain do you test?

Note that accepting HTTP/2 connections over TLS requires the “Application-Layer Protocol Negotiation” (ALPN) TLS extension support, which is available only since OpenSSL version 1.0.2. Using the “Next Protocol Negotiation” (NPN) TLS extension for this purpose (available since OpenSSL version 1.0.1) is not guaranteed.


http://nginx.org/en/docs/http/ngx_http_v2_module.html
 
followed and double check, but gotten this error

nginx: [emerg] invalid port in "|IP|:|PORT_80|" of the "listen" directive in /etc/nginx/nginx-vhosts.conf:2
nginx: configuration file /etc/nginx/nginx.conf test failed
 
additionally

running command ./build nginx

/usr/local/directadmin/custombuild/custom/nginx/configure.nginx: line 20: --with-http_v2_module: command not found

*** There was an error while trying to configure Nginx. Check the custom/nginx/configure.nginx file
[root@mia2 custombuild]#
 
Back
Top