3
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AWS - Amazon Linuxにh2oをインストール

Last updated at Posted at 2016-03-06

Amazon Linuxにh2oをインストールする手順です。
*EC2インスタンスの作成〜h2o起動〜index.html表示まで
*EC2インスタンスの作成は割愛

  • h2oのバージョン(2016/03/06 時点)
# h2o --version
h2o version 2.0.0-DEV
OpenSSL: LibreSSL 2.2.6

事前作業(EC2の通信許可)

tcp:20(SSH)
tcp:80(HTTP)
tcp:443(HTTPS)

SSH接続->rootに変更

$ sudo su

必要なものをインストール

$ yum -y groupinstall "Development Tools"
$ yum -y install curl curl-devel
$ yum -y install libarchive libarchive-devel
$ yum -y install expat expat-devel
$ yum -y install libyaml-devel
$ yum -y install zlib zlib-devel
$ yum -y install openssl

cmake3.0.2をインストール

$ cd /usr/local/src
$ wget http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz
$ tar -xvf cmake-3.0.2.tar.gz
$ cd cmake-3.0.2
./bootstrap --prefix=/usr       \
        --system-libs       \
        --mandir=/share/man \
        --docdir=/share/doc/cmake-3.0.2   &&
$ make
$ make install

h2oをインストール

$ cd /usr/local/src
$ git clone https://github.com/h2o/h2o.git
$ cd h2o/
$ cmake -DWITH_BUNDLED_SSL=on .
$ make h2o
$ make install

自己証明書の作成(3650日有効)

$ cd /usr/local/src/h2o
$ mkdir conf
$ cd conf
$ openssl genrsa 2048 > cert.key
$ openssl req -new -key cert.key  > cert.csr
$ openssl x509 -days 3650 -req -signkey cert.key < cert.csr > cert.pem

設定ファイル作成

logファイル作成

$ touch /usr/local/src/h2o/access-log
$ touch /usr/local/src/h2o/error-log
$ touch /usr/local/src/h2o/pid-file

設定ファイル作成

$ cd /usr/local/src/h2o/conf
$ vi h2o.conf

h2o.confに以下を記述

user: root
hosts:
  "*":
    listen:
      port: 443
      ssl:
        certificate-file: /usr/local/src/h2o/conf/cert.pem
        key-file:  /usr/local/src/h2o/conf/cert.key
    paths:
      "/":
        file.dir: /usr/local/src/h2o/doc

access-log: /usr/local/src/h2o/access-log
error-log: /usr/local/src/h2o/error-log
pid-file: /usr/local/src/h2o/pid-file

h2o起動

起動前のチェック

$ /usr/local/src/h2o/h2o -m test -c /usr/local/src/h2o/conf/h2o.conf

起動

$ /usr/local/src/h2o/h2o -m daemon -c /usr/local/src/h2o/conf/h2o.conf

停止

$ kill -TERM `cat /usr/local/src/h2o/pid-file`

ブラウザから接続して確認

https:///index.html

参考

3
5
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
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?