This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
openbsd:openhttpd [2019/11/10 11:36] jrmu created |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | Setting up OpenBSD's default web server, openhttpd, is relatively simple. Start off by copying the example file in /etc/examples/httpd.conf: | ||
- | <code> | ||
- | $ doas cp /etc/examples/httpd.conf /etc/httpd.conf | ||
- | </code> | ||
- | |||
- | Here is what /etc/httpd.conf contains: | ||
- | |||
- | <code> | ||
- | server "example.com" { | ||
- | listen on * port 80 | ||
- | location "/.well-known/acme-challenge/*" { | ||
- | root "/acme" | ||
- | request strip 2 | ||
- | } | ||
- | location * { | ||
- | block return 302 "https://$HTTP_HOST$REQUEST_URI" | ||
- | } | ||
- | } | ||
- | |||
- | server "example.com" { | ||
- | listen on * tls port 443 | ||
- | tls { | ||
- | certificate "/etc/ssl/example.com.fullchain.pem" | ||
- | key "/etc/ssl/private/example.com.key" | ||
- | } | ||
- | location "/pub/*" { | ||
- | directory auto index | ||
- | } | ||
- | location "/.well-known/acme-challenge/*" { | ||
- | root "/acme" | ||
- | request strip 2 | ||
- | } | ||
- | } | ||
- | </code> |