Pirx un[blog]ged

Mike is reading four blogs. This is none of them.

Build and run nghttp2 with asio support

Here is a step by step instruction to build nghttp2 library with asio support on ubuntu 14.04 / 15.04:

$ sudo apt-get install make binutils autoconf  automake autotools-dev \
  libtool pkg-config zlib1g-dev libcunit1-dev libssl-dev libxml2-dev \
  libev-dev libevent-dev libjansson-dev \
  libjemalloc-dev cython python3.4-dev
$ sudo apt-get install libboost-all-dev
$ mkdir nghttp2
$ cd nghttp2
$ git init
$ git pull https://github.com/tatsuhiro-t/nghttp2.git
$ autoreconf -i
$ automake
$ autoconf
$ ./configure -enable-asio-lib
$ make

ready. Probably you want to install the library on your system you may call

sudo make install

To run the asio example a certificate is required. For testing purposes a self-signed certificate should be sufficient. A good and straight forward instruction is available here. If you follow the example, you get two files: server.key and server.crt. Copy these files into the examples subdirectory and start the HTTP2 server as follows:

cd examples
./asio-sv2 0.0.0.0 8081 4 . server.key server.crt

Now the server is listening on port 8081 with 4 threads running. Start the browser of your choice and enter the URL https://localhost:8081/ Your browser should alert you, that this connection is untrusted. For example, firefox pops up with the following warning:

untrusted connection

After adding the exception you will see a blank browser page. Now it's your turn to create a valid index.html to make the server hum.


comments powered by Disqus