Skip to content

Instantly share code, notes, and snippets.

@masakielastic
Last active February 21, 2026 17:50
Show Gist options
  • Select an option

  • Save masakielastic/6becb561eacc0e5e3e39927a6f3a717a to your computer and use it in GitHub Desktop.

Select an option

Save masakielastic/6becb561eacc0e5e3e39927a6f3a717a to your computer and use it in GitHub Desktop.
Debian で HTTP サーバーの H2O をビルドする

Debian で HTTP サーバーの H2O をビルドする

Debian 13 (trixie) では H2O のパッケージが用意されなくなったので、自分でビルドする必要があります。

依存パッケージの導入

sudo apt update
sudo apt install -y \
  git build-essential cmake \
  zlib1g-dev libssl-dev \
  libyaml-dev pkg-config

ソースコードの取得

mkdir -p ~/src
cd ~/src
git clone --recursive https://github.com/h2o/h2o.git
cd h2o

ビルドとインストール

mkdir -p build
cd build

cmake .. \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_INSTALL_PREFIX="$HOME/.local"
cmake --build . -j"$(nproc)"
cmake --install .
which h2o
h2o -v

起動

mkdir -p ~/h2o-test
cd ~/h2o-test
cat > h2o.conf <<'EOF'
listen:
  host: 127.0.0.1
  port: 8080

hosts:
  default:
    paths:
      /:
        file.dir: .
EOF

echo "hello h2o" > index.html
h2o -c h2o.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment