溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》
  • 首頁 > 
  • 教程 > 
  • 服務(wù)器 > 
  • Centos7.4服務(wù)器安裝apache及安裝過程出現(xiàn)的問題解決方法

Centos7.4服務(wù)器安裝apache及安裝過程出現(xiàn)的問題解決方法

發(fā)布時(shí)間:2020-09-28 08:40:12 來源:腳本之家 閱讀:326 作者:小菜鳥有大夢(mèng)想 欄目:服務(wù)器

本文實(shí)例講述了Centos7.4服務(wù)器安裝apache及安裝過程出現(xiàn)的問題解決方法。分享給大家供大家參考,具體如下:

一、安裝httpd

1. 安裝之前,先查看系統(tǒng)中是否存在已經(jīng)安裝了的httpd.rpm包,如果,沒有就是沒安裝,有的話rpm -e 對(duì)應(yīng)的rpm包名進(jìn)行刪除

#rpm -qa | grep httpd

2. 使用yum安裝(自動(dòng)安裝依賴包),簡(jiǎn)單方便

#yum -y install httpd

3. 安裝成功后,httpd-v 查看安裝的apache版本,查找apache的配置文件位置

#find / -name "httpd.conf"

4. 將找到的源配置文件備份一份,防止錯(cuò)誤后無法恢復(fù)

#cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak

5. 啟動(dòng)Apache服務(wù)

#systemctl start httpd.service

6. 開機(jī)自動(dòng)啟動(dòng)Apache服務(wù)

#systemctl enable httpd.service 開機(jī)自啟httpd
#systemctl disable httpd.service 開機(jī)不啟動(dòng)httpd

7. 查看httpd的狀態(tài)

#systemctl status httpd.service

二、安裝過程出現(xiàn)的問題

1. Apache啟動(dòng)失敗,Job for httpd.service failed because the control process exited with error code. See “systemctl status httpd.service” and “journalctl -xe” for details

執(zhí)行命令,查看報(bào)錯(cuò)提示

#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 [::]:80
11月 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:80
11月 26 11:13:09 cloud1.localdomain httpd[9913]: no listening sockets available, shutting down
11月 26 11:13:09 cloud1.localdomain httpd[9913]: AH00015: Unable to open logs
11月 26 11:13:09 cloud1.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
11月 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=1
11月 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.

問題是80端口被占用

解決辦法:

查看80端口的使用情況

① .netstat -lnp|grep 80

tcp        0      0 192.168.180.68:61027        0.0.0.0:*                   LISTEN      6289/oproxyd
tcp        0      0 :::80                       :::*                        LISTEN      846/httpd
tcp        0      0 ::ffff:192.168.180.68:7001 :::*                        LISTEN      32015/java

殺掉占用80端口的進(jìn)程

② .kill -9 846

③ .若是前兩個(gè)方法不行的話,則重啟后再啟動(dòng)httpd服務(wù)

2.Apache啟動(dòng)失敗,httpd:httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName

① .進(jìn)入apache的配置文件

vi /etc/httpd/conf/httpd.conf

② ./ServerName 查找ServerName

#ServerName www.example.com:80

將其前面的#去掉

:wq保存并退出

③ .重啟服務(wù)

systemctl restart httpd.service

希望本文所述對(duì)大家CentOS服務(wù)器配置有所幫助。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI