Tested on OpenBSD 6.3 and 6.4

Configure httpd(8) on OpenBSD

Install OpenBSD.

Edit /etc/httpd.conf. Add two server sections—one for www and another for naked domain (all requests are redirected to www).

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

server "example.com" {
  listen on * port 80
  block return 301 "http://www.example.com$REQUEST_URI"

httpd(8) is chrooted to /var/www by default, so let’s make a document root directory:

# mkdir -p /var/www/htdocs/www.example.com

Save and check the configuration. Enable httpd(8) and start it.

# httpd -n
configuration ok
# rcctl enable httpd
# rcctl start httpd

Publish your website

Copy your website content into /var/www/htdocs/www.example.com 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.

    example.com. 300 IN     A XXX.XXX.XXX.XXX
www.example.com. 300 IN     A XXX.XXX.XXX.XXX

Examine your DNS is propagated.

$ dig example.com www.example.com
example.com.         299     IN      A       XXX.XXX.XXX.XXX
www.example.com.     299     IN      A       XXX.XXX.XXX.XXX

Check IP addresses in answer sections.

Open your website in a browser.


Enable HTTPS on your server.