启动apache时出现httpd: Could not reliably determine the server

来源:互联网 发布:c程编程分解质因数 编辑:程序博客网 时间:2024/05/20 08:45

启动apache时出现

[root@centos apache2]#sudo /etc/init.d/apache2 restart
httpd: Could not reliably determine the server's fully qualified domain name, using 121.10.40.155 for ServerName

现在提供该问题的解决方法

1)进入apache配置文件的目录:(视个人安装情况而不同)

[root@centos /]# cd /etc/httpd //我安装时配置文件所在的目录为/etc/httpd

2)编辑httpd.conf文件,搜索"#ServerName",添加ServerName localhost:80

[root@centos httpd]# ls
conf.d  extra  httpd.conf  magic  mime.types  original

[root@centos httpd]# vi httpd.conf

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80
更改为:

ServerName localhost:80

3)再重新启动apache 即可。

[root@centos httpd]#sudo /etc/init.d/apache2 restart

OK,启动成功啦!

0 0
原创粉丝点击