解决方案:
进入apache的安装目录:
#vim /etc/httpd/conf/httpd.conf
将其中一行#ServerName localhost:80注释#号去掉即可。
再重启服务httpd即可。