!!!OpenBSD Webサーバ (httpd on OpenBSD OpenBSD ==6.8== 7.0) {{category OpenBSD,nolink}}OpenBSD の Webサーバ httpd(relayd) で、Webサーバを動かす。 OpenBSD に初期で組み込まれている Web サーバが、Apache 1.3系 から(nginx になって)、OpenBSD 5.6 に独自のもの relayd に変更されている。 CGI の実行は [[OpenBSD/httpd/68(relayd+slowcgi)]] を。 SSL(TSL) 接続は [[OpenBSD/httpd/68(relayd+tsl)]] も参照。 * 関連 man → [httpd(8)|https://man.openbsd.org/httpd.8], [httpd.conf(5)|https://man.openbsd.org/httpd.conf.5] !!! httpd の起動設定 !! 自動起動 サーバが起動したときに httpd も実行されるように、'''/etc/rc.conf.local''' に '''httpd_flags''' を指定する。 # httpd web server httpd_flags= または、'''rcctl enable httpd''' で有効にする( /etc/rc.conf.local に httpd_flags= が記載される)。 !! デバッグ root ユーザのコンソールで、'''-dvv''' オプションをつけて実行すると、処理の内容が表示される。 # httpd -dvv startup  :後略 !!! Webサーバ(httpd) の設定 '''/etc/httpd.conf''' に設定する。サンプルが /etc/examples/httpd.conf にある。 OpenBSD の httpd は、 '''/var/www''' に chroot されるようになっている。 !! 静的ドキュメント '''/var/www/htdocs''' 以下の静的ドキュメントを表示させる(/var/www に chroot され、ドキュメントルートは /htdocs)。 # $OpenBSD: httpd.conf,v 0.00 2021/01/01 00:00:00 xxxxx Exp $ server "default" { listen on * port 80 # Optional, but probably best - change your syslog.conf to do # what you want with it then. #log syslog root "/htdocs" directory auto index } # Include MIME types instead of the built-in ones types { include "/usr/share/misc/mime.types" # Necessary to ensure patch files show up as text not binary text/plain sig } !! 動的ドキュメント slowcgi を使い CGI を実行させる。[[OpenBSD/httpd/68(relayd+slowcgi)]] を参照。 !! SSL(TSL) 接続 SSL(TSL) 接続の設定 および ACME client を用いて Let's Encrypt の証明書の更新。[[OpenBSD/httpd/68(relayd+tsl)]] を参照。