搭建简易网站

1、检查环境

 getenforce #查看selinux运行状态 setenforce 0 #临时关闭selinux

  

 vim /etc/selinux/config #编辑selinux配置文件 将SELINUX=enforcing改为 SELINUX=disabled  #永久关闭

 

2、配置yum源

     mkdir /iso       #创建挂载点
     mount /dev/cdrom /iso     #挂载光盘到挂载点
     ls /iso      #查看挂载是否成功
     cd /etc/yum.repos.d/     #进入yum源目录
     rm -fr *.repo       #删除官方源
     vim iso.repo       #编辑源文件

 [iso] name=iso baseurl=file:///iso enabled=1 gpgcheck=0 

      yum clean all    #清除yum源缓存
3、安装服务

   yum -y install httpd    #安装httpd服务
   rm -rf /etc/httpd/conf.d/welcome.conf   #删除欢迎页
4、启动服务

   systemctl start httpd    #启动httpd
   systemctl enable httpd   #设置httpd开机启动

5、添加防火墙端口

 firewall-cmd --add-port=80/tcp #临时添加 firewall-cmd --add-port=80/tcp --permanent #永久添加

       ip a 查看本机ip

6、编辑主页

 echo "成功" > /var/www/html/index.html

7、验证

      浏览器访问 ip

相关文章