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.

http://XXX.XXX.XXX.XXX/

Your web server should be up and running.

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 ... ;; ANSWER SECTION: example.com. 299 IN A XXX.XXX.XXX.XXX ... ;; ANSWER SECTION: www.example.com. 299 IN A XXX.XXX.XXX.XXX ... $

Check IP addresses in answer sections.

Open your website in a browser.

http://www.example.com/

Enable HTTPS on your server.

© 2008–2019 Roman Zolotarev User Agreement Privacy Policy