问题描述:通过yum install -y httpd 安装好Apache后启动报错,如下:
[[email protected] ~]# 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 [确定]
解决办法:
- 编辑hosts文件
[[email protected] 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是我自己的机器名称 [[email protected] html]里面@后面就是机器名
完成hosts文件编辑后,解决了一个问题。还有错误提示
[[email protected] 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
[[email protected] conf]# ls
extra httpd.conf magic mime.types original
[[email protected] conf]# vi httpd.conf
#ServerName www.example.com:80
ServerName it3246:80
3.重启apache。
[[email protected] etc]# service httpd status
httpd (pid 29506) 正在运行...
注意:文章中it3246是根据自己机器替换的 是自己的主机名