On Ubuntu 14.04.4 LTS with HHVM(HipHop VM 3.14.1) and Nginx(nginx/1.10.1)

I try to enable HTTP/2 like the following in my vhost

server {
    listen 443 ssl http2 default_server;
    listen [::]:443 ssl http2 default_server;

    root /var/www/mydomain;
    index index.html index.htm index.php;

    server_name mydomain.com;

    ssl_certificate /etc/nginx/ssl/www_mydomain_com.pem;
    ssl_certificate_key /etc/nginx/ssl/server.key;

    access_log /var/log/nginx/localhost.laravel-access.log;
    error_log  /var/log/nginx/locahost.laravel-error.log error;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;

    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt  { log_not_found off; access_log off; }

    error_page 404 /index.php;

    include hhvm.conf;  # The HHVM Magic Here

    # Deny .htaccess file access
    location ~ /\.ht {
        deny all;

    #Add Expires headers
    location ~* \.(?:ico|css|js|gif|jpe?g|png|jpg|woff|woff2)$ {
        expires 30d;
        add_header Pragma public;
        add_header Cache-Control "public";

server {
    listen         80;
    listen    [::]:80;
    server_name    mydomain.com;
    return         301 https://$server_name$request_uri;

But, when I try to check at HTTP/2 test, I always get

Negative! mydomain.com does not support HTTP/2.0. Supported protocols: http/1.1

ALPN is not supported.


$ nginx -V as the following

nginx version: nginx/1.10.1
built with OpenSSL 1.0.1f 6 Jan 2014
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -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 --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_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads --add-module=/build/nginx-abUnII/nginx-1.10.1/debian/modules/nginx-auth-pam --add-module=/build/nginx-abUnII/nginx-1.10.1/debian/modules/nginx-dav-ext-module --add-module=/build/nginx-abUnII/nginx-1.10.1/debian/modules/nginx-echo --add-module=/build/nginx-abUnII/nginx-1.10.1/debian/modules/nginx-upstream-fair --add-module=/build/nginx-abUnII/nginx-1.10.1/debian/modules/ngx_http_substitutions_filter_module

How I can enable HTTP/2?

  • Please show the output of nginx -V. – gf_ Jun 27 '16 at 7:35
  • @gf_ nginx/1.10.1 – Set Kyar Wa Lar Jun 27 '16 at 7:36
  • 1
    That's the output of nginx -v, but I asked for the output of nginx -V. – gf_ Jun 27 '16 at 7:37
  • @gf_ please see on my question edit. – Set Kyar Wa Lar Jun 27 '16 at 7:40

Well, the error message you've got is quite obvious:

ALPN is not supported.

Application-Layer Protocol Negotiation aka ALPN is a Transport Layer Security (TLS) extension for application layer protocol negotiation. ALPN allows the application layer to negotiate which protocol should be performed over a secure connection in a manner which avoids additional round trips and which is independent of the application layer protocols. It is used by HTTP/2. Additionally, it's also needed by HTTP/2 (AFAIK).

ALPN is supported by / using openssl => 1.0.2. According to your output of nginx -V, your nginx was built with òpenssl 1.0.1f, so this can't and won't work. To enable (and use) HTTP/2, you've to run a more modern version of nginx. Recently, I've explained a way to do this here. (But please don't copy/paste this, this won't work, as it deals with Debian.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.