Чтобы включить http2 для nginx, необходим сам nginx версии от 1.10 и установленный openssl v >= 1.0.2.

Стоит отметить, что http2 подразумевает под собой использование протоколов шифрования: TLS 1, TLS 1.2, TLS 1.3. Если Ваш сервер НЕ поддерживает их, то http2 работать НЕ будет. НО! Также стоит обратить внимание на то, что многие устаревшие браузеры, не поддерживающие или частично поддерживающие TLS 1+, могут возвращать ошибку 500 (внутренняя ошибка сервера), и, соответственно, пользователь с этим браузером НЕ получит необходимое содержимое, а лишь пустой экран или отсутствие необходимых файлов (img, video, etc).

Смотрите также HTTP/2 Server Push вместе с NGINX 1.13.9+

Поэтому необходимо НЕ выключать поддержку SSL! Либо произведите тестирование на своих users.

 ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;

Чтобы узнать версию nginx (и openssl), введите команду:

nginx -V

Там будет:

nginx version: nginx/1.10.x
built with OpenSSL 1.1.x 25 May 2017 (running with OpenSSL 1.1.x 20 Nov 2018)
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-0TiIP5/nginx-1.10.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-z,relro -Wl,-z,now' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_flv_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_perl_module=dynamic --with-http_random_index_module --with-http_secure_link_module --with-http_sub_module --with-http_xslt_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-stream=dynamic --with-stream_ssl_module --add-dynamic-module=/build/nginx-0TiIP5/nginx-1.10.3/debian/modules/headers-more-nginx-module --add-dynamic-module=/build/nginx-0TiIP5/nginx-1.10.3/debian/modules/nginx-auth-pam --add-dynamic-module=/build/nginx-0TiIP5/nginx-1.10.3/debian/modules/nginx-cache-purge --add-dynamic-module=/build/nginx-0TiIP5/nginx-1.10.3/debian/modules/nginx-dav-ext-module --add-dynamic-module=/build/nginx-0TiIP5/nginx-1.10.3/debian/modules/nginx-development-kit --add-dynamic-module=/build/nginx-0TiIP5/nginx-1.10.3/debian/modules/nginx-echo --add-dynamic-module=/build/nginx-0TiIP5/nginx-1.10.3/debian/modules/ngx-fancyindex --add-dynamic-module=/build/nginx-0TiIP5/nginx-1.10.3/debian/modules/nchan --add-dynamic-module=/build/nginx-0TiIP5/nginx-1.10.3/debian/modules/nginx-lua --add-dynamic-module=/build/nginx-0TiIP5/nginx-1.10.3/debian/modules/nginx-upload-progress --add-dynamic-module=/build/nginx-0TiIP5/nginx-1.10.3/debian/modules/nginx-upstream-fair --add-dynamic-module=/build/nginx-0TiIP5/nginx-1.10.3/debian/modules/ngx_http_substitutions_filter_module

Далее, все еще проще.

Получите TLS сертификат (он же SSL, если что) на сайте https://www.sslforfree.com если не знаете как, погуглите видео об этом сайте, их очень много.

Добавьте TLS сертификат в конфигурационный файл nginx в раздел http{  ... server{..СЮДА..}  ...  }

 ssl_certificate /etc/nginx/crt/certificate.crt;
ssl_certificate_key /etc/nginx/crt/private.key;

также необходимо сгенерировать dhparam.pem командой:

openssl dhparam -out /etc/nginx/crt/dhparam.pem 4096

Затем САМОЕ ГЛАВНОЕ:

конфиг server{..ЗДЕСЬ..}

listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 ipv6only=on;

А также:

add_header Strict-Transport-Security "max-age=15768000; includeSubDomains" always;
#http2_push_preload on;
ssl_dhparam /etc/nginx/crt/dhparam.pem;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK;
#add_header Strict-Transport-Security max-age=15768000;
ssl_stapling on;

Общий конфиг (nginx.conf):

user www-data;
worker_processes auto;
worker_rlimit_nofile 64000;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
worker_connections 768;
multi_accept on;
}

http {

include /etc/nginx/sites-available/*.conf;
include /etc/nginx/mime.types;
default_type application/octet-stream;


##inverser

server_tokens off;

open_file_cache max=200000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;


output_buffers 1 8m;


tcp_nodelay on;
client_max_body_size 1999m;


# Expires map
map $sent_http_content_type $expires {
default off;
text/html epoch;
text/css max;
application/javascript max;
~image/ max;
}


sendfile on;
tcp_nopush on;
keepalive_timeout 65;
types_hash_max_size 2048;

keepalive_requests 100;
reset_timedout_connection on;

##
# Logging Settings
##

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

##
# Gzip Settings
##

gzip on;
gzip_disable "msie6";

gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
gzip_min_length 10240;

##
# Virtual Host Configs
##

#include /etc/nginx/conf.d/*.conf;
#include /etc/nginx/sites-available/*;
server_names_hash_bucket_size 64;
}

файл test.com (в папке sites-available):

server {
if ( $scheme = "http" ) {
rewrite ^/(.*)$ https://$host/$1 permanent;
}
listen 80;
server_name test.com www.test.com;
return 301 https://$host$request_uri;
}

server{

expires $expires;
### include google-analytics.conf;
# location / {
# post_action @GAlog;
# }
#location = /404.html {
# post_action @GAlog404;
#}


if ($request_method !~ ^(GET|HEAD|POST)$ ){return 444;}
ssl on;
server_tokens off;
#listen 80;
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 ipv6only=on;

ssl_certificate /etc/nginx/crt/certificate.crt;
ssl_certificate_key /etc/nginx/crt/private.key;
server_name test.com www.test.com;
ssl_session_cache shared:SSL:5m;
ssl_session_timeout 1h;
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains" always;
#http2_push_preload on;
ssl_dhparam /etc/nginx/crt/dhparam.pem;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK;
#add_header Strict-Transport-Security max-age=15768000;
ssl_stapling on;

root /var/www/html/test.com;
charset utf8;

location ~ \.(eot|ttf|otf|woff|woff2)$ {
add_header Access-Control-Allow-Origin *;
access_log off;
expires 365d;
}

location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|pdf|ppt|txt|docx|doc|rtf|js|ttf|otf|woff2|eot|svg|woff)$ {
access_log off;
expires 365d;
}

location ~ \.mp4$
{valid_referers none blocked
test.pro www.test.pro;

if ($invalid_referer) {
rewrite ^/ https://test.com/errorvps?rq=$request&rf=$http_referer&st=$status;
}
mp4;
if ($request_filename ~* ^.*?/([^/]*?)$)
{
set $filename $1;
add_header Content-Disposition "attachment; filename=$filename";
}
}

location ~ \.flv$
{valid_referers none blocked
test.pro www.test.pro;

if ($invalid_referer) {
rewrite ^/ https://test.com/errorvps?rq=$request&rf=$http_referer&st=$status;
}
flv;
}

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_read_timeout 300;
index index.php;
}

location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php index.php;
}

location @missing {
rewrite ^ $scheme://$host/index.php permanent;
}


error_page 404 https://test.com/errorvps?rq=$request&rf=$http_referer&st=$status;
error_page 403 https://test.com/errorvps?rq=$request&rf=$http_referer&st=$status;
error_page 405 https://test.com/errorvps?rq=$request&rf=$http_referer&st=$status;
error_page 415 https://test.com/errorvps?rq=$request&rf=$http_referer&st=$status;
error_page 401 https://test.com/errorvps?rq=$request&rf=$http_referer&st=$status;
error_page 402 https://test.com/errorvps?rq=$request&rf=$http_referer&st=$status;
error_page 500 https://test.com/errorvps?rq=$request&rf=$http_referer&st=$status;

}
##SERVER

Вся загвоздка в том, что http2 у меня НЕ через VPN тестировать не получилось, что на 100%-ном http2, что на моем сервере. Http2 виден только через прокси Opera, в моем случае!

Необходимо следить за развитием TLS и обновлять Ваше ПО, т.к. более новые версии браузеров, скорее всего, могут не поддерживать http2, если используется не последняя (на текущий момент) версия TLS.

Кстати, можно связать Google Anlytics+nginx: https://habr.com/ru/company/driverpack/blog/260553/

# Номер нашего счетчика и основного домена
set $gaID 'UA-XXXXXXXX-12';
set $mainDomain 'XXXX.COM';

# Пробрасываем ClientID через cookie "_ga_cid"
# Важно, чтобы cookie была установлена для всех субдоменов
set $cid $cookie__ga_cid;
if ($cid = '') {


set $cid "$request_time$request_length.$msec$connection";

}
add_header Set-Cookie "_ga_cid=$cid; path=/; domain=.$mainDomain" always;


set $postURI $uri;
set $postRequestURI $request_uri;
set $postIP $remote_addr;
set $postHOST $host;


# Отправка события pageview
location @GAlog {
resolver 8.8.8.8 ipv6=off
internal;

proxy_ignore_client_abort on;
proxy_next_upstream timeout;

proxy_pass http://google-analytics.com/collect?v=1&dh=$postHOST&dt=$postHOST&tid=$gaID&cid=$cid&cd1=$cid&uip=$postIP&cd2=$request_time&cd3=$body_bytes_sent&t=pageview&dp=$postURI;
}

# Отправка события 404
location @GAlog404 {
resolver 8.8.8.8 ipv6=off;
internal;

proxy_ignore_client_abort on;
proxy_next_upstream timeout;

proxy_pass http://google-analytics.com/collect?v=1&tid=$gaID&cid=$cid&cd1=$cid&uip=$postIP&t=event&el=nginx&ec=404&ea=$postHOST$postRequestURI;
}

# Отправка события 500
location @GAlog500 {
resolver 8.8.8.8 ipv6=off;
internal;

proxy_ignore_client_abort on;
proxy_next_upstream timeout;

proxy_pass http://google-analytics.com/collect?v=1&tid=$gaID&cid=$cid&cd1=$cid&uip=$postIP&t=event&el=nginx&ec=500&ea=$postHOST$postRequestURI;
}

Проверить http2 онлайн: https://tools.keycdn.com/http2-test

Посмотреть, что поддерживает Ваш сервер по TLS: https://www.ssllabs.com/ssltest/index.html

http2 в nginx