So I just installed Apache on a new CentOS 7 server, using Yum. I've installed Apache many times before, but never have I seen this: When I run ps aux now, it always shows
/usr/sbin/httpd -DFOREGROUND
Google tells me that means the process will run in the foreground and not detach from the shell, but I don't really get what that means - if I close my shell, will Apache die?
I just want to get the normal Apache behaviour, and have httpd run like it always used to, chugging along in the background, do I need to disable DFOREGROUND? (I can't figure out how to btw)
The
-DFOREGROUND
option does indeed mean that Apache won't fork, but that doesn't mean that it's attached to your shell!The service is started by systemd when you run
systemctl start httpd
(or the old style way,service httpd start
). It is systemd to which Apache is attached, and systemd is managing the process as one of its children. This is done so that systemd can easily tell whether Apache has crashed, without having to poll a pid file or do other nasty hackery. This also means that systemd is capable of automatically restarting Apache if it does crash.Run
systemctl status httpd
to see its status. An example looks like: