On a OpenBSD machine running OpenBSD 6.2 amd64, httpd cannot be started by using rcctl:
# rcctl start httpd
httpd(failed)
However, when started by just entering httpd
, it works; but this is not the way to go, I guess. /var/log/messages
does not contain any hints, nor does any other file in /var/log/
.
My /etc/httpd.conf
is rather simple:
server "default" {
listen on * port 80
}
/var/www
exists and /var/www/htdocs
contains files which are served when started manually. Specifying "root" in /etc/httpd.conf
had no effect.
How can I get httpd
to be enabled/started automatically by rcctl
?
Best Answer
Your issue was that the
httpd
daemon was given an invalid command line argument (the stringYES
) when started usingrcctl
and therefore would not start properly.The only "special" value for the
XXX_flags
variables in/etc/rc.conf.local
is the two letter stringNO
, which disables the corresponding service. This is the default value for most of OpenBSD's services (see/etc/rc.conf
, which you should never modify).A service is enabled using
rcctl
as root with e.g.In the case of
httpd
, this will write the lineinto
/etc/rc.conf.local
, which will enable thehttpd
service.The value of
httpd_flags
will be passed to the actualhttpd
daemon upon starting it. You could for example make it read an alternative configuration file withrcctl
can be used to modify/etc/rc.conf.local
like this:It's preferable to use
rcctl
over doing modifications to/etc/rc.conf.local
directly with an editor.