就不干开发

导航

阿帕奇报错及解决方案

重启阿帕奇说不能完全解析域名,80端口被占用
[root@localhost ~]# apachectl restart
httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
httpd not running, trying to start
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
语法检测说不能完全解析域名,但语法都对
[root@localhost ~]# apachectl -t
httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
Syntax OK
强制杀死阿帕奇服务
[root@localhost ~]# killall -9 httpd
[root@localhost ~]# ss -tnl |grep 80
开启服务,检测80端口以起用,但能然不能解析域名
[root@localhost ~]# apachectl start
httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
[root@localhost ~]# ss -tnl |grep 80
LISTEN 0 128 :::80 :::*
查看原始网页格式不是之前编辑的格式,说明自带的阿帕奇服务没删除,查看并删除
[root@localhost htdocs]# curl www.bl.com
[root@localhost htdocs]# rpm -q httpd
httpd-2.2.15-29.el6.centos.x86_64
[root@localhost htdocs]# yum -y remove httpd
[root@localhost ~]# apachectl restart
httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
查看网页文件是否有错
[root@localhost ~]# vim /usr/local/httpd/htdocs/index.html
[root@localhost ~]# vim /usr/local/httpd/conf/httpd.conf
仍然不能使用命令执行,说明之前创建的软链接可能无效
[root@localhost ~]# apachectl restart
bash: /usr/sbin/apachectl: 没有那个文件或目录
[root@localhost ~]# ls /usr/local/bin/
ab apachectl apr-1-config apu-1-config apxs checkgid dbmmanage envvars envvars-std htcacheclean htdbm htdigest htpasswd httpd httxt2dbm logresolve rotatelogs
[root@localhost ~]# service httpd restart
httpd: 未被识别的服务
[root@localhost ~]# ss -tnl |grep 80
LISTEN 0 128 :::80 :::*
[root@localhost ~]# apachectl -t
bash: /usr/sbin/apachectl: 没有那个文件或目录
脚本文件也没有了,先放置脚本文件,进行配置
[root@localhost ~]# cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
[root@localhost ~]# vim /etc/init.d/httpd
[root@localhost ~]# vim /etc/init.d/httpd
[root@localhost ~]# apachectl stop
bash: /usr/sbin/apachectl: 没有那个文件或目录
[root@localhost ~]# apachectl start
bash: /usr/sbin/apachectl: 没有那个文件或目录
[root@localhost ~]# service httpd status
/etc/init.d/httpd: line 94: lynx: command not found
[root@localhost ~]# vim /usr/local/httpd/conf/httpd.conf
[root@localhost ~]# apachectl -t
bash: /usr/sbin/apachectl: 没有那个文件或目录
根据提示创建到对应软链接
[root@localhost ~]# ln -s /usr/local/httpd/bin/* /usr/sbin/
[root@localhost htdocs]# curl www.bt.com
修改相关配置并正常开启服务
[root@localhost ~]# vim /usr/local/httpd/conf/httpd.conf
[root@localhost ~]# vim /usr/local/httpd/htdocs/index.html
重新设置开机自启

[root@localhost 桌面]# chkconfig --list httpd
httpd 服务支持 chkconfig,但它在任何级别中都没有被引用(运行“chkconfig --add httpd”)
[root@localhost 桌面]# chkconfig --level 35 httpd on
[root@localhost 桌面]# chkconfig --list httpd
httpd 0:关闭 1:关闭 2:关闭 3:启用 4:关闭 5:启用 6:关闭

[root@localhost ~]# apachectl restart
浏览器验证

posted on 2021-01-19 00:13  专注运维20年  阅读(401)  评论(0编辑  收藏  举报