H2Oでベーシック認証したい場合は以下のようにします1

paths:
  "/":
    mruby.handler: |
      require "htpasswd.rb"
      Htpasswd.new("/etc/h2o/.htpasswd", "realm-name")

また、 .htpasswd で plain フォーマットはサポートされていません。

failed to validate password using file:/etc/h2o/.htpasswd:crypt-style password hash is not supported

.htpasswd を手動で作成したい場合は以下の方法でできます2

require "digest/sha1"
require "base64"
open("/etc/h2o/.htpasswd", "w") do |w|
  w.write("user:{SHA}#{Base64.encode64(Digest::SHA1.digest("password"))}")
end
  1. Configure > Using Basic Authentication, DeNA Co., Ltd. et al., https://h2o.examp1e.net/configure/basic_auth.html, 2017/02/20 閲覧 

  2. Password Formats, The Apache Software Foundation., https://httpd.apache.org/docs/2.4/misc/password_encryptions.html, 2017/02/20 閲覧