1、检查apache是否有安装过
rpm -qa|grep http
//如果查询到有安装,需要卸载 rpm -e --nodeps 要卸载软件名称
2、正式安装apache
yum install httpd -y
3、启动apache
systemctl start httpd
4、查看端口监听
netstat -antp|grep 80 //使用netstat需要安装好网络工具包 yum install net-tools -y
5、添加80端口的防火墙放开规则
firewall-cmd --add-port=80/tcp --permanent
firewall-cmd --reload
6、测试访问
http://ip 这里的ip为自己的ip
当出现则安装成功
7、apache服务器相关目录
网页存放目录 /var/www/html/
配置文件存放目录:/etc/httpd/conf.d/
8、尝试创建静态网页,测试
cd /var/www/html
touch index.html
vi index.html
内容:
测试访问: http://ip/index.html