解決方案:
進入apache的安裝目錄:
#vim /etc/httpd/conf/httpd.conf
將其中一行#ServerName localhost:80註釋#號去掉即可。
再重啓服務httpd即可。