LoginSignup
3
4

More than 5 years have passed since last update.

h2oでhttp2を試してみる

Last updated at Posted at 2015-12-23

h2oでもhttp2を試してみた記事です。

h2o
https://github.com/h2o/h2o
https://h2o.examp1e.net/

環境

CentOS Linux release 7.1
vagrant

事前準備

#yum groupinstall "Development Tools"
#yum install cmake libyaml-devel zlib zlib-devel openssl-devel libssl-#devel libuv wslay gcc bison

本体のインストール

#git clone https://github.com/h2o/h2o.git
#git submodule update --init --recursive
#cmake .
#cmake -DWITH_BUNDLED_SSL=on .
#make
#make install

設定

cd /home/vagant/h2o/examples/h2o/h2o.conf
vi /home/vagrant/h2o/examples/h2o/h2o.conf
h2o.conf
# to find out the configuration commands, run: h2o --help

listen: 80
listen:
  port: 443
  ssl:
    certificate-file: /home/vagrant/h2o/examples/h2o/server.crt
    key-file: /home/vagrant/h2o/examples/h2o/server.key
hosts:
  "127.0.0.1.xip.io:80":
    paths:
      /:
        file.dir: examples/doc_root
access-log: /h2o/logs/access_log
error-log: /h2o/logs/error_log

hosts:
  "127.0.0.1.xip.io:443":
    paths:
      /:
        file.dir: examples/doc_root
access-log: /h2o/logs/ssl_access_log
error-log: /h2o/logs/ssl_error_log

鍵の準備

#mkdir ssl
#cd ssl
#openssl genrsa 2048 > server.key
#openssl req -new -key server.key > server.csr

設定ファイルに記載のある場所にmoveする

起動

#/usr/local/bin/h2o -m daemon -c examples/h2o/h2o.conf
output
# ps ax | grep h2o
 4528 ?        S      0:00 perl -x /usr/local/share/h2o/start_server --log-file=/root/h2o/logs/ssl_error_log --daemonize --port=0.0.0.0:80 --port=[::]:80 --port=0.0.0.0:443 --port=[::]:443 -- /usr/local/bin/h2o -c examples/h2o/h2o.conf
 4529 ?        Sl     0:00 /usr/local/bin/h2o -c examples/h2o/h2o.conf
 4533 ?        S      0:00 perl -x /usr/local/share/h2o/annotate-backtrace-symbols
 4608 pts/0    S+     0:00 grep --color=auto h2o

# ss -anp | grep 443
u_str  ESTAB      0      0                      * 13443                 * 14391 users:(("systemd-logind",566,12),("systemd-logind",566,10))
u_dgr  UNCONN     0      0                      * 14438                 * 5663  users:(("NetworkManager",558,4))
u_str  ESTAB      0      0      /var/run/dbus/system_bus_socket 14391                 * 13443 users:(("dbus-daemon",567,10))
tcp    LISTEN     0      128                    *:443                   *:*      users:(("h2o",4529,20),("h2o",4529,7),("perl",4528,7))
tcp    LISTEN     0      128                   :::443                  :::*      users:(("h2o",4529,21),("h2o",4529,8),("perl",4528,8))
3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4