notes from mnlwldr

Thoughts about programming and other things I want to share

@mnlwldr on Twitter @mnlwldr on GitHub @mnlwldr on Mastodon

OpenBSD comes with a built-in webserver called httpd, written by Reyk Flöter.

So that means in contrast to most Linux distributions, this is not a rebranded version of the Apache webserver. Instead, it’s a very basic webserver.

The idea behind this is very much in line with the larger OpenBSD philosophy that security is top priority and performance may take a hit in achieving that.

Basic configuration

Populate /etc/httpd.conf and replace with your domain

server "" {
  listen on * port 80
  root "/htdocs/"
The httpd daemon is chrooted to /var/www by default. So `/htdocs/` means `/var/www/htdocs/` here.

That’s the whole configuration you need. Now we create our document root on the filesystem and add a simple index.html placeholder.

mkdir -p /var/www/htdocs/
echo "Hello World from OpenBSD 6.3" > /var/www/htdocs/

You can check your configuration with

httpd -n

When everything looks good, we can enable (start on boot) and start httpd

rcctl enable httpd
rcctl start httpd

Now you should reach your website with your IP address. That is a very basic configuration to serve static content, you can read more about in the manpage HTTPD.CONF(5). If you like, you can configure HTTPS with Let’s encrypt now.

Have you written a response to this? Let me know the URL