一、检查并卸载原有的 apache 软件包列表
- 查看 httpd 软件包列表
rpm -qa |grep httpd
- 卸载 apache
yum install -y epel-release
yum install -y dnf
dnf remove httpd\*
- 检测是否卸载
rpm -qa |grep httpd
二、使用 yum 安装
- 安装
yum install -y httpd
- 查看 80 端口是否被占用,被占用将无法启动
netstat -antlp | grep 80
- 启动 apache 服务
systemctl start httpd
- 客户端浏览器测试
http://182.92.150.105
三、apache rpm包安装的常用命令
systemctl start httpd 启动
systemctl stop httpd 停止
systemctl restart httpd 重启
systemctl enable httpd 开机启动
systemctl disable httpd 开机不启动
systemctl list-unit-files | grep httpd 检查Apache是否已经安装了开机自动启动
systemctl status httpd 检查状态
yum remove -y httpd yum 卸载httpd软件包
dnf remove httpd\* 卸载httpd所有软件包,包括工具包
四、rpm 包 apache 常见配置文件位置
配置文件位置: /etc/httpd/conf/httpd.conf
网页文件位置:/var/www/html/
日志文件位置:/var/log/httpd/
五、开机自启
systemctl enable httpd 开机启动
systemctl disable httpd 开机不启动
systemctl list-unit-files | grep httpd 检查Apache是否已经安装了开机自动启动
网友评论