Setup httpd in OpenBSD


OpenBSD 5.6 introduced a new daemon called httpd, which supports CGI (via FastCGI) and TLS. No additional work is needed to install the new httpd daemon because it is included in the base system. This article explains how to setup a basic web server using it.


We will be editing the following files.

  • /etc/rc.conf.local
  • /etc/httpd.conf

Simply add httpd_flags="" into /etc/rc.conf.local.

Open /etc/rc.conf.local in your favorite text editor and add:


Update /etc/httpd.conf. Use the example below as a template, and make changes as noted below in the comments. Replace “example” accordingly.

ext_ip="" # Change this value to your vultr IPserver "default" {        listen on $ext_ip port 80 } types {         text/css css ;         text/html htm html ;         text/txt txt ;         image/gif gif ;         image/jpeg jpg jpeg ;         image/png png ;         application/javascript js ;         application/xml xml ; } server "" {         listen on $ext_ip port 80         root "/htdocs/" } server "" {         listen on $ext_ip port 80         root "/htdocs/" }

Alternatively, you can include all the Mime Types as follows:

types {        include "/usr/share/misc/mime.types"} 

Next, upload your web content and put it into /var/www/htdocs/

Start the server

Your new httpd daemon is configured for use. Now, you just need to start the server:

$ doas /etc/rc.d/httpd start

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article

No comments

Powered by Blogger.