yaourt --needed --noconfirm -S --force libuv h2o-git
You can use this configuration if you want standalone web server (h2o requires TLS encrpytion for HTTP/2):
listen:
port: 3030
ssl:
certificate-file: /path/to/localhost.crt
key-file: /path/to/localhost.key
http2-max-concurrent-requests-per-connection: 1024
num-threads: 1
hosts:
127.0.0.1:
paths:
/:
file.dir: /path/to/htdocs
file.dirlisting: ON
Or if you want to use it as reverse proxy (just like normal NginX use case):
listen:
port: 3040
ssl:
certificate-file: /path/to/server.crt
key-file: /path/to/server.key
http2-max-concurrent-requests-per-connection: 1024
num-threads: 1
hosts:
localhost:
paths:
/:
proxy.reverse.url: http://127.0.0.1:3030
proxy.keepalive: ON
The h2o server seems not allowing HTTP/2 to be used when started without SSL. If you don't have any SSL certificate yet, just use this command to generate self-signed certificate:
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout localhost.key -out localhost.crt
To start the h2o program, just write those configuration (don't forget to change the certificate-file, key-file, and file.dir to use the correct path) to a file named h2o.conf, then just type:
$ h2o
[OCSP Stapling] disabled for certificate file:/tmp/localhost.crt
[INFO] raised RLIMIT_NOFILE to 65536
h2o server (pid:11108) is ready to serve requests
[OCSP Stapling] disabled for certificate file:/tmp/localhost.crt
To check which websites already using SPDY, you can visit chrome://net-internals/#spdy. You can also use this Chrome extension or this Firefox plugin to check is it SPDY enabled site (see the lightning sign after installing ).
To check public website for SPDY or HTTP/2 support (labeled as h2-xx, where xx is the spec revision), you can use spdycheck.org. Another way to check a site is using HTTP/2 without browser is using latest httpie-http2 or nghttp2-git, that you can install using these commands:
# httpie
yaourt --needed --noconfirm -S --force python-pip
sudo pip3 install -U httpie httpie-http2
# nghttp2
yaourt --needed --noconfirm -S --force cunit libev
yaourt --needed --noconfirm -S --force nghttp2-git
then just execute one of these commands:
# httpie
http https://nghttp2.org/httpbin/get
# nghttp2
nghttp2 -nva https://localhost:3030
The httpie command, always failed when using self-signed certificate (even when --verify=no enabled). For nghttp2, when there are line containing The negotiated protocol: h2, it shows HTTP/2 protocol being used.