栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

linux apache的 yum安装

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

linux apache的 yum安装

linux apache的 yum安装
(本人机器 centos 7属于红帽7系列,操作不一样的,自行百度)
本机ip 192.168.1.135
也叫httpd服务

第一步、关闭防火墙和SElinux
简单:
临时关闭防火墙
systemctl stop firewalld
临时关闭SElinux
setenforce 0
第二步,找源
添加阿里云yum源(非必要)
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

安装阿里云yum扩展源(非必要)
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

第三步,安装
yum install -y httpd

查看端口是否被占用
netstat -tunlp | grep 80

(我这里被占用是因为我用了nginx,搜不到就是空的,不用执行杀死进程)
杀死进程
kill -9 pid号 这里我的是49462

OK安装成功

启动
systemctl start httpd
重启
systemctl restart httpd
开机启动
systemctl enable httpd
关闭
systemctl stop httpd
apache主配置文件 /etc/httpd/conf/httpd.conf
apache子配置文件/etc/httpd/conf.d/ 下

启动

进入分享目录
cd /var/www/html/


把百度界面缓存一下
wget www.baidu.com
重启
systemctl restart httpd
在浏览器输入iP地址进入了百度界面

当然,打印文字也是可以的
echo “hello world” > /var/www/html/index.html

重启
systemctl restart httpd
在浏览器输入iP地址

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/827279.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号