千家信息网

Centos7.4服务器安装apache及安装过程出现的问题解决方法

发表于:2025-02-23 作者:千家信息网编辑
千家信息网最后更新 2025年02月23日,本文实例讲述了Centos7.4服务器安装apache及安装过程出现的问题解决方法。分享给大家供大家参考,具体如下:一、安装httpd1. 安装之前,先查看系统中是否存在已经安装了的httpd.rpm
千家信息网最后更新 2025年02月23日Centos7.4服务器安装apache及安装过程出现的问题解决方法

本文实例讲述了Centos7.4服务器安装apache及安装过程出现的问题解决方法。分享给大家供大家参考,具体如下:

一、安装httpd

1. 安装之前,先查看系统中是否存在已经安装了的httpd.rpm包,如果,没有就是没安装,有的话rpm -e 对应的rpm包名进行删除

#rpm -qa | grep httpd

2. 使用yum安装(自动安装依赖包),简单方便

#yum -y install httpd

3. 安装成功后,httpd-v 查看安装的apache版本,查找apache的配置文件位置

#find / -name "httpd.conf"

4. 将找到的源配置文件备份一份,防止错误后无法恢复

#cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak

5. 启动Apache服务

#systemctl start httpd.service

6. 开机自动启动Apache服务

#systemctl enable httpd.service 开机自启httpd#systemctl disable httpd.service 开机不启动httpd

7. 查看httpd的状态

#systemctl status httpd.service

二、安装过程出现的问题

1. Apache启动失败,Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details

执行命令,查看报错提示

#systemctl status httpd.service
[root@cloud1 bin]# systemctl status httpd.service  httpd.service - The Apache HTTP Server  Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)  Active: failed (Result: exit-code) since 五 2018-11-26 11:13:09 CST; 6min ago   Docs: man:httpd(8)      man:apachectl(8) Process: 9915 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE) Process: 9913 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE) Main PID: 9913 (code=exited, status=1/FAILURE)11月 26 11:13:09 cloud1.localdomain httpd[9913]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:8011月 26 11:13:09 cloud1.localdomain httpd[9913]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:8011月 26 11:13:09 cloud1.localdomain httpd[9913]: no listening sockets available, shutting down11月 26 11:13:09 cloud1.localdomain httpd[9913]: AH00015: Unable to open logs11月 26 11:13:09 cloud1.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE11月 26 11:13:09 cloud1.localdomain kill[9915]: kill: cannot find process ""11月 26 11:13:09 cloud1.localdomain systemd[1]: httpd.service: control process exited, code=exited status=111月 26 11:13:09 cloud1.localdomain systemd[1]: Failed to start The Apache HTTP Server.11月 26 11:13:09 cloud1.localdomain systemd[1]: Unit httpd.service entered failed state.11月 26 11:13:09 cloud1.localdomain systemd[1]: httpd.service failed.

问题是80端口被占用

解决办法:

查看80端口的使用情况

① .netstat -lnp|grep 80

tcp 0 0 192.168.180.68:61027 0.0.0.0:* LISTEN 6289/oproxyd
tcp 0 0 :::80 :::* LISTEN 846/httpd
tcp 0 0 ::ffff:192.168.180.68:7001 :::* LISTEN 32015/java

杀掉占用80端口的进程

② .kill -9 846

③ .若是前两个方法不行的话,则重启后再启动httpd服务

2.Apache启动失败,httpd:httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName

① .进入apache的配置文件

vi /etc/httpd/conf/httpd.conf

② ./ServerName 查找ServerName

#ServerName www.example.com:80

将其前面的#去掉

:wq保存并退出

③ .重启服务

systemctl restart httpd.service

希望本文所述对大家CentOS服务器配置有所帮助。

服务 配置 问题 文件 端口 方法 服务器 过程 不行 成功 两个 位置 办法 命令 备份 实例 就是 情况 版本 状态 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 流放之路蜘蛛祝福技能数据库 河北电商软件开发定制 软件开发中设计阶段 数据库中目或度是什么意思 泰韬网络技术有限公司招聘 杭州载言网络技术 怎么看数据库中各个表的关系 打开数据库错误4064 嵌入式 软件开发 架构设计 数据库架构的优化要求 电脑怎么退出网络安全调试模式 软件开发实习总结报告 安庆服务器机柜企业 中国知名网络安全工程师 软件开发的基本手段 中央网络安全和信息化委员会韩 服务器远程管理bios 北理工计算机软件开发 天天炫斗新版服务器 网上手游软件开发 绝地求生服务器卡掉了 第五人格最恐怖的服务器 网络安全主题教育活动报道怎么写 网站服务器安全维护的作用 山西智慧养老软件开发系统 软件开发要什么技术 云服务器esc添加安全组 服务器连接失败代码什么意思 石湾企业网络安全产品 网络安全都有哪些岗位
0