Nginx in OpenBSD 5.2-Release

Nginx(8) is the replacement web server for the old patched Apache 1.3 in OpenBSD.  As of OpenBSD 5.2, Nginx(8) is still not the primary [default] web server in the BSD release and allows for users to slowly migrate from Apache to Nginx(8) without additional  package install.

What if you are deploying a new server and have no need to do the migration from Apache?  Well, as I found out there is a few little start up configuration items that need to be addressed to ensure that your server comes up after a reboot.

If you look in the /etc/rc file:

start_daemon hostapd rwhod lpd sendmail smtpd httpd ftpd ftpproxy tftpd

You’ll note the httpd(8) rc.d will be called if the flags are set to anything other than “NO”.  httpd(8) refers to the Apache instance in base and not Nginx(8).

To ensure Nginx(8)starts up on reboot (if you want to run it on each start up), you’ll need the following in your /etc/rc.conf.local file:
pkg_scripts=”nginx”The OpenBSD team as always, puts security above functionality and the base installation (not the one from pkgs/ports) of Nginx(8) has been put into chroot(8) by default.  I don’t want my instance in this case to run as chroot(8), so I have specified the “-u” flag.  Leave this flag as “” [NULL] if you want to continue using the Nginx(8) webserver in chroot(8) mode.