首页 > 开发 > Apache > 正文

启动和重启apache2时出现报错的处理方法

2020-07-28 15:03:23
字体:
来源:转载
供稿:网友
  一、启动apache遇到错误:httpd: Could not reliably determine the server's fully qualified domain name
  [root@server httpd-2.2.4]# /usr/local/apache/bin/apachectl start
  httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName,解决方法如下:
  1)进入apache的安装目录:(视个人安装情况而不同) [root@server ~]# cd /usr/local/apache/conf
  2)编辑httpd.conf文件,搜索"#ServerName",添加ServerName localhost:80
  [root@server conf]# ls
  extra httpd.conf magic mime.types original
  [root@server conf]# vi httpd.conf
  #ServerName www.example.com:80
  ServerName localhost:80
  3)再重新启动apache 即可。
  [root@server ~]# /usr/local/apache/bin/apachectl restart
  二、重启报错apache2 address already in use:make_sock:could not bind to address [::]:80
  此错误为端口被占用,只有进入root用户,才可以查看所有端口被占用的情况,因此需要:
  $su
  #netstat -lnp | grep 80
  tcp 0 x x.x.x.x:8084 ... listen 1167/mono
  tcp 0 x x.x.x.x:80 ... listen 1194/inetd
  udp 0 x x.x.x.x:2080 ... listen 14427/drcomauthsvr
  查看知道是Inetd占用了80端口
  #kill 1194
  #exit //退出root用户
  $sudo apapche2ctl -k start
  启动成功!
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表