Roman's avatar

Hi, my name is Roman. I run a job board and make tutorials for BSD users. I'm fan of OpenBSD, POSIX-shell, and vi.

Twitter - RSS - Patreon - PayPal

Configure OpenBSD httpd(8) on your web server

Deploy and login to your OpenBSD server first.

As soon as you're there you can enable an httpd(8) daemon, it's already installed on OpenBSD, you just need to configure it:

www# vi /etc/httpd.conf

Add two server sections---one for www and another for naked domain (all requests are redirected to www).

server "" {
  listen on * port 80
  root "/htdocs/"

server "" {
  listen on * port 80
  block return 301 "$REQUEST_URI"

httpd is chrooted to /var/www by default, so let's make a document root directory:

www# mkdir -p /var/www/htdocs/

Save and check this configuration:

www# httpd -n
configuration ok

Enable httpd(8) daemon and start it.

www# rcctl enable httpd
www# rcctl start httpd

Publish your website

Copy your website content into /var/www/htdocs/ and then test it your web browser.


Your web server should be up and running.

Update DNS records

If there is another HTTPS server using this domain, configure that server to redirect all HTTPS requests to HTTP.

Now as your new server is ready you can update DNS records accordingly. 300 IN     A XXX.XXX.XXX.XXX 300 IN     A XXX.XXX.XXX.XXX

Examine your DNS is propagated.

$ dig

Check IP addresses it answer sections. If they are correct, you should be able to access your new web server by its domain name.

What's next? Enable HTTPS on your server.

Tested on OpenBSD 6.3.