httpd – 对Apache的DFOREGROUND感到困惑

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

所以我刚刚使用Yum在新的CentOS 7服务器上安装了Apache.我之前已经多次安装过Apache,但我从未见过这样:当我现在运行ps aux时,它总是显示出来

 

/usr/sbin / httpd -DFOREGROUND

Google告诉我,这意味着该进程将在前台运行而不是从shell中分离,但我真的没有得到这意味着 – 如果我关闭我的shell,Apache会死吗?

我只想获得正常的Apache行为,让httpd像往常一样运行,在后台继续运行,我是否需要禁用DFOREGROUND? (我无法弄清楚如何顺便说一句)

-DFOREGROUND选项确实意味着Apache不会fork,但这并不意味着它附加到你的shell!

 

当您运行systemctl start httpd(或旧样式方式,服务httpd start)时,systemd将启动该服务.它是附加Apache的系统,systemd将进程作为其子级之一进行管理.这样做是为了让systemd可以很容易地判断Apache是​​否已经崩溃,而不必轮询pid文件或做其他令人讨厌的hackery.这也意味着systemd is capable of automatically restarting Apache如果确实崩溃了.

运行systemctl status httpd以查看其状态.一个例子如下:

 

# systemctl status httpd
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
   Active: active (running) since Sat 2014-07-12 01:53:50 UTC; 1 weeks 3 days ago
  Process: 21400 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS)
 Main PID: 390 (httpd)
   Status: "Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec"
   CGroup: /system.slice/httpd.service
           ├─  390 /usr/sbin/httpd -DFOREGROUND
           ├─15379 /usr/sbin/httpd -DFOREGROUND
           ├─15858 /usr/sbin/httpd -DFOREGROUND
           ├─16809 /usr/sbin/httpd -DFOREGROUND
           ├─16944 /usr/sbin/httpd -DFOREGROUND
           ├─17079 /usr/sbin/httpd -DFOREGROUND
           ├─17351 /usr/sbin/httpd -DFOREGROUND
           ├─17487 /usr/sbin/httpd -DFOREGROUND
           ├─17772 /usr/sbin/httpd -DFOREGROUND
           ├─17908 /usr/sbin/httpd -DFOREGROUND
           └─18043 /usr/sbin/httpd -DFOREGROUND

Jul 12 01:53:50 hozen httpd[390]: AH02559: The SSLCertificateChai...d
Jul 12 01:53:50 hozen httpd[390]: AH00558: httpd: Could not relia...e
Jul 12 01:53:50 hozen systemd[1]: Started The Apache HTTP Server.
Jul 13 03:30:02 hozen systemd[1]: Reloading The Apache HTTP Server.
Jul 13 03:30:02 hozen httpd[9332]: AH02559: The SSLCertificateCha...d
Jul 13 03:30:02 hozen systemd[1]: Reloaded The Apache HTTP Server.
Jul 21 03:19:02 hozen systemd[1]: Reloading The Apache HTTP Server.
Jul 21 03:19:02 hozen httpd[21400]: AH02559: The SSLCertificateCh...d
Jul 21 03:19:02 hozen systemd[1]: Reloaded The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.

转载于:https://my.oschina.net/u/3371661/blog/3055957

你可能感兴趣的:(httpd – 对Apache的DFOREGROUND感到困惑)