本文實例講述了Centos7.4服務器安裝apache及安裝過程出現的問題解決方法。,具體如下:
一、安裝httpd
1. 安裝之前,先查看系統中是否存在已經安裝了的httpd.rpm包,如果,沒有就是沒安裝,有的話rpm -e 對應的rpm包名進行刪除
#rpm -qa | grep httpd
2. 使用yum安裝(自動安裝依賴包),簡單方便
#yum -y install httpd
3. 安裝成功后,httpd-v 查看安裝的apache版本,查找apache的配置文件位置
#find / -name "httpd.conf"
4. 將找到的源配置文件備份一份,防止錯誤后無法恢復
#cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
5. 啟動Apache服務
#systemctl start httpd.service
6. 開機自動啟動Apache服務
#systemctl enable httpd.service 開機自啟httpd#systemctl disable httpd.service 開機不啟動httpd
7. 查看httpd的狀態
#systemctl status httpd.service
二、安裝過程出現的問題
1. Apache啟動失敗,Job for httpd.service failed because the control process exited with error code. See “systemctl status httpd.service” and “journalctl -xe” for details
執行命令,查看報錯提示
#systemctl status httpd.service
[root@cloud1 bin]# systemctl status httpd.service httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since 五 2018-11-26 11:13:09 CST; 6min ago Docs: man:httpd(8) man:apachectl(8) Process: 9915 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE) Process: 9913 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE) Main PID: 9913 (code=exited, status=1/FAILURE)11月 26 11:13:09 cloud1.localdomain httpd[9913]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:8011月 26 11:13:09 cloud1.localdomain httpd[9913]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:8011月 26 11:13:09 cloud1.localdomain httpd[9913]: no listening sockets available, shutting down11月 26 11:13:09 cloud1.localdomain httpd[9913]: AH00015: Unable to open logs11月 26 11:13:09 cloud1.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE11月 26 11:13:09 cloud1.localdomain kill[9915]: kill: cannot find process ""11月 26 11:13:09 cloud1.localdomain systemd[1]: httpd.service: control process exited, code=exited status=111月 26 11:13:09 cloud1.localdomain systemd[1]: Failed to start The Apache HTTP Server.11月 26 11:13:09 cloud1.localdomain systemd[1]: Unit httpd.service entered failed state.11月 26 11:13:09 cloud1.localdomain systemd[1]: httpd.service failed.
新聞熱點
疑難解答