当前位置 主页 > 服务器问题 > Linux/apache问题 >

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

    栏目:Linux/apache问题 时间:2019-07-18 09:50

      一、启动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
      启动成功!