用的统信,apache安装后无法访问服务启动失败了!

需要的工具:centos 7.x以上的镜像文件本地VMware 15.5以上Navicat Premium使用XSHELL 7和XFTP 其他软件都可Wechat_devtool (微信开发者工具) ego微商客户端源码相关软件和源码:
hi,这是我用百度网盘分享的内容~复制这段内容打开「百度网盘」APP即可获取链接:https://pan.baidu.com/s/1U8VrsKr-01aXWyuZ5FfWOg?pwd=1024提取码:1024
yum install httpd #安装apache服务
当我们执行systemctl status httpd时报错信息:Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details通过提示信息**See "systemctl status httpd.service" and "journalctl -xe" for details执行journalctl -xe命令,May 07 10:10:15 localhost.localdomain dbus[580]: [system] Successfully activated service 'org.freedesktop.problems'
May 07 10:12:34 localhost.localdomain kernel: perf: interrupt took too long (16513 > 15557), lowering kernel.perf_event_max_sample_rate to 12000
May 07 10:13:48 localhost.localdomain polkitd[617]: Registered Authentication Agent for unix-process:5169:404183 (system bus name :1.220 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 07 10:13:52 localhost.localdomain polkitd[617]: Operator of unix-process:5169:404183 successfully authenticated as unix-user:root to gain ONE-SHOT authorization for action org.freedesktop.systemd1.manage-units for system-bus-name::1.221 [systemctl start httpd] (owne
May 07 10:13:52 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has begun starting up.
May 07 10:13:52 localhost.localdomain httpd[5186]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
May 07 10:13:52 localhost.localdomain httpd[5186]: (98)Address already in use: AH00073: make_sock: unable to listen for connections on address [::]:80
May 07 10:13:52 localhost.localdomain httpd[5186]: (98)Address already in use: AH00073: make_sock: unable to listen for connections on address 0.0.0.0:80
May 07 10:13:52 localhost.localdomain httpd[5186]: no listening sockets available, shutting down
May 07 10:13:52 localhost.localdomain httpd[5186]: AH00015: Unable to open logs
May 07 10:13:52 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
May 07 10:13:52 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has failed.
--
-- The result is failed.
May 07 10:13:52 localhost.localdomain polkitd[617]: Unregistered Authentication Agent for unix-process:5169:404183 (system bus name :1.220, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
May 07 10:13:52 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
May 07 10:13:52 localhost.localdomain systemd[1]: httpd.service failed.
May 07 10:13:58 localhost.localdomain su[5193]: (to root) zws on pts/0
May 07 10:13:58 localhost.localdomain su[5193]: pam_unix(su:session): session opened for user root by zws(uid=1000)
May 07 10:13:58 localhost.localdomain dbus[580]: [system] Activating service name='org.freedesktop.problems' (using servicehelper)
May 07 10:13:58 localhost.localdomain dbus[580]: [system] Successfully activated service 'org.freedesktop.problems'
May 07 10:14:12 localhost.localdomain polkitd[617]: Registered Authentication Agent for unix-process:5232:406549 (system bus name :1.226 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 07 10:14:12 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has begun starting up.
May 07 10:14:12 localhost.localdomain httpd[5239]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
May 07 10:14:12 localhost.localdomain httpd[5239]: (98)Address already in use: AH00073: make_sock: unable to listen for connections on address [::]:80
May 07 10:14:12 localhost.localdomain httpd[5239]: (98)Address already in use: AH00073: make_sock: unable to listen for connections on address 0.0.0.0:80
May 07 10:14:12 localhost.localdomain httpd[5239]: no listening sockets available, shutting down
May 07 10:14:12 localhost.localdomain httpd[5239]: AH00015: Unable to open logs
May 07 10:14:12 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
May 07 10:14:12 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has failed.
--
-- The result is failed.
May 07 10:14:12 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
May 07 10:14:12 localhost.localdomain systemd[1]: httpd.service failed.
May 07 10:14:12 localhost.localdomain polkitd[617]: Unregistered Authentication Agent for unix-process:5232:406549 (system bus name :1.226, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
查看端口占用情况:netstat -antlp
grep 80 #查看80端口占用情况
发现nginx服务占用80端口,我们关闭该服务,再次重启httpd服务即可systemctl stop nginx.service #关闭nginx服务systemctl start httpd.service #开启apache服务systemctl enable httpd.service #apache服务开机启动我们只需要暂停: nginx 服务,然后再次启动Apache服务service nginx stopsystemctl status httpd这时候提示显示已经启动成功:httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Sat 2022-05-07 10:28:17 CST; 13s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 5527 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic:
0 B/sec"
Tasks: 6
CGroup: /system.slice/httpd.service
├─5527 /usr/sbin/httpd -DFOREGROUND
├─5531 /usr/sbin/httpd -DFOREGROUND
├─5532 /usr/sbin/httpd -DFOREGROUND
├─5533 /usr/sbin/httpd -DFOREGROUND
├─5534 /usr/sbin/httpd -DFOREGROUND
└─5535 /usr/sbin/httpd -DFOREGROUND
May 07 10:28:17 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
May 07 10:28:17 localhost.localdomain httpd[5527]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
May 07 10:28:17 localhost.localdomain systemd[1]: Started The Apache HTTP Server.
原因:
nginx和apache都需要用到80端口,所以此时nginx和apache无法同时启动。此时可以通过修改nginx或者apache的监听端口来解决,一般来说我们不希望修改nginx的默认端口,此时可以修改apache的配置文件来达到目的。2)修改配置文件,将监听端口改为8080,重启apache服务
原来是需要将Apache注册到Linux服务里面啊!注册Apache到Linux服务在Linux下用源代码方式编译安装完Apache后,启动关闭Apache可以通过如下命令实现:/usr/local/apache/bin/apachectl start
stop
restart如果想将httpd列入系统自动启动的服务,可以直接将上述的apachectl文件拷贝到 /etc/rc.d/init.d 中,然后在相应的启动级别如3,5中加入链接即可。命令如下:cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd # 复制到init.d 并重命名为httpdln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S61httpd链接文件的S61是启动时的序号。当init.d目录下有httpd脚本后,我们就可以通过service命令来启动关闭apache了。在任意路径下执行:service httpd start
stop
restart这时有个问题就是:虽然apache已经可以自动启动,但在linux的服务列表中却看不到它,要添加服务,一般通过chkconfig --add xxx来实现,但需要脚本中有相应的信息才行,否则chkconfig就会提示:xxx 服务不支持 chkconfig。所以我们首先编辑httpd脚本,在第2行(#!/bin/sh下面)添加如下注释信息(包括#):# chkconfig: 35 61 61# description: Apache第一行的3个参数意义分别为:在哪些运行级别启动httpd(3,5);启动序号(S61);关闭序号(K61)。注意:第二行的描述必须要写!保存后执行:chkconfig --add httpd #所有开机模式下自启动,另外chkconfig httpd on 表示345模式下自启动就将httpd添加入服务了。在rc3.d、rc5.d路径中将来就会出现S61httpd的链接,其他运行级别路径中会出现K61httpd的链接。运行下面的命令查看服务,就可以看到httpd的服务了。chkconfig --list
阅读终点,创作起航,您可以撰写心得或摘录文章要点写篇博文。去创作
您愿意向朋友推荐“博客详情页”吗?
强烈不推荐
不推荐
一般般
推荐
强烈推荐

时间:2020-07-08 15:39
作者:
来源:系统城1. 扫描二维码随时看资讯2. 请使用手机浏览器访问:https://m.xitongcheng.com/jiaocheng/dnrj_article_62538.html 手机查看
评论反馈Apache是使用最广泛的Web服务器软件,但最近有用户的电脑却出现了apache启动失败的情况,这是怎么回事呢?我们又该如何解决这一问题呢?下面本文就为大家整理了关于apache启动失败的解决方法,一起往下看吧。解决方法如下:一、端口占用问题1、这个是最有可能出现Apache无法启动的问题之一,运行CMD然后执行netstat -aon
findstr :80 ;2、如果发现端口被多个占用,你可以用Win+R的方式,输入Regedit进入注册表,找HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\HTTP 修改Start这一项,将其改为0。二、Apache存放路径问题1、通过命令行使用打开CMD定位到:[你的Apache路径本人下载的解压文件,然后直接解压路径为D:\httpd-2.4.20-x64-vc14-r2\Apache24]\bin,并在命令行内输入httpd.exe -k install -n “Apache2.4” 回车;2、发现路径提示有错,有两种解决办法,把Apache24放在在根目录下,或者去配置你的Conf文件。本文以改变路径方式为例,将Apache24存放在D盘根目录下;3、此时在定位到path:/bin,运行httpd.exe -k install -n “Apache2.4”即可。三、运行方式问题1、通过上面第三步我们发现提示的问题告诉我们需要以管理员的身份运行;2、然后在执行上面第三步,定位到path:/bin,运行httpd.exe -k install -n “Apache2.4”即可。以上就是apache启动失败的解决方法啦,有出现同样情况的可以按照上面的方法来解决哦。

我要回帖

更多关于 apache安装后无法访问 的文章