解決apache啓動錯誤

問題描述:通過yum install -y httpd 安裝好Apache後啓動報錯,如下:

註釋:綠色的是命令行提示的輸出的內容。黑色字綠色底紋的命令是輸入的內容。

[root@it3246 ~]# service httpd start

正在啓動 httpd:httpd: apr_sockaddr_info_get() failed for it3246

httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName                                                           [確定]

解決辦法:

  1. 編輯hosts文件

 [root@it3246 html]# vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

127.0.0.1   it3246

注意:根據自己的機器主機名改 it3246是我自己的機器名稱 [root@it3246 html]裏面@後面就是機器名


完成hosts文件編輯後,解決了一個問題。還有錯誤提示


[root@it3246 etc]# service httpd restart

停止 httpd:                                               [確定]

正在啓動 httpd:httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

2.解決辦法:

   編輯httpd.conf文件,搜索到"#ServerName",添加ServerName it3246:80或者去掉原本的

#ServerName www.example.com:80  前面的註釋 後面改成 it3246:80

[root@server conf]# ls

extra  httpd.conf  magic  mime.types  original

[root@server conf]# vi httpd.conf

#ServerName www.example.com:80

ServerName it3246:80

3.重啓apache。

[root@it3246 etc]# service httpd status

httpd (pid  29506) 正在運行...


注意:文章中it3246是根據自己機器替換的 是自己的主機名

博客不經常在線,可以加QQ(同步微信交流)1600157341

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章