DEV Community

Cover image for How to run a webserver with httpd on OpenBSD 6.3
manuel
manuel

Posted on • Originally published at wildauer.io on

3 1

How to run a webserver with httpd on OpenBSD 6.3

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

server "example.com" {
  listen on * port 80
  root "/htdocs/example.com"
}

Enter fullscreen mode Exit fullscreen mode

The httpd daemon is chrooted to /var/www by default so root "/htdocs/example.com" means /var/www/htdocs/exmaple.com.

We should create our document root

mkdir -p /var/www/htdocs/example.com
Enter fullscreen mode Exit fullscreen mode

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

echo "Hello World from OpenBSD 6.3">/var/www/htdocs/example.com/index.html
Enter fullscreen mode Exit fullscreen mode

Check httpd configuration

httpd -n
Enter fullscreen mode Exit fullscreen mode

When everythings looks ok, enable and start httpd

rcctl enable httpd
rcctl start httpd
Enter fullscreen mode Exit fullscreen mode

Now you should reach your website with your IP address.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay