因此我剛剛使用Yum在新的CentOS 7服務器上安裝了Apache.我以前已經屢次安裝過Apache,但我從未見過這樣:當我如今運行ps aux時,它老是顯示出來shell
/usr/sbin / httpd -DFOREGROUND服務器
Google告訴我,這意味着該進程將在前臺運行而不是從shell中分離,但我真的沒有獲得這意味着 – 若是我關閉個人shell,Apache會死嗎?rest
我只想得到正常的Apache行爲,讓httpd像往常同樣運行,在後臺繼續運行,我是否須要禁用DFOREGROUND? (我沒法弄清楚如何順便說一句)code
-DFOREGROUND選項確實意味着Apache不會fork,但這並不意味着它附加到你的shell!進程
當您運行systemctl start httpd(或舊樣式方式,服務httpd start)時,systemd將啓動該服務.它是附加Apache的系統,systemd將進程做爲其子級之一進行管理.這樣作是爲了讓systemd能夠很容易地判斷Apache是否已經崩潰,而沒必要輪詢pid文件或作其餘使人討厭的hackery.這也意味着systemd is capable of automatically restarting Apache若是確實崩潰了.ip
運行systemctl status httpd以查看其狀態.一個例子以下:get
# 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.