support and follow me on Twitter

"...Thank you @romanzolotarev for the awesome guide on setting this up!"
lamdanerd (@lambdanerd)

Tested on OpenBSD 6.3.

Configure httpd(8) on OpenBSD

Deploy and login to your server.

Edit /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(8) is chrooted to /var/www by default, so let's make a document root directory:

# mkdir -p /var/www/htdocs/

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/ 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
;; ANSWER SECTION:         299     IN      A       XXX.XXX.XXX.XXX
;; ANSWER SECTION:     299     IN      A       XXX.XXX.XXX.XXX

Check IP addresses in answer sections.

Open your website in a browser.

Enable HTTPS on your server.