How to run a webserver with httpd on OpenBSD 6.3

Set up a simple webserver with httpd on OpenBSD 6.3 to serve static pages like a jekyll blog.

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 root "/htdocs/" means /var/www/htdocs/

We should create our document root

mkdir -p /var/www/htdocs/

add a index.html file with a placeholder to the new directory

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

Check httpd configuration

httpd -n

When everythings looks ok, enable and start httpd

rcctl enable httpd
rcctl start httpd

Now you should reach your website with your IP address. Maybe, you want configure HTTPS with Let’s encrypt now.

Return to home