Centos7搭建web服务器

181 阅读1分钟

搭建web服务器 提供网站服务

  1. 配置IP地址
  • vim /etc/sysconfig/network-scripts/ifcfg-ens33

2. 启动 network服务 查看IP地址

  • systemctl restart network
  • ifconfig

3. 关闭防火墙

  • systemctl stop firewalld

4.查看并 安装httpd服务软件包

  1. 查看是否安装 httpd服务软件包,未安装则使用yum安装httpd服务软件包,也可以使用httpd源码包(编译)安装,可以根据需求自行选择安装方式。
  • rpm -qa httpd

2. 编辑yum环境

  • rm -rf /etc/yum.repos.d/*
  • vim /etc/yum.repos.d/yum.repo
  • mount /dev/cdrom /mnt/
  • ls /mnt/

3.使用yum安装httpd服务软件包

  • yum -y install httpd

4.查看是否成功安装httpd服务软件包

  • rpm -qa httpd

5.启动httpd服务

  • systemctl start httpd

6。查看httpd服务状态

  • systemctl status httpd

7.启用httpd服务

  • systemctl enable httpd

8.编辑httpd服务首页

  • vim /var/www/html/index.html

5.使用客户机 验证

在客户机打开 浏览器 输入 www.//web服务器的ip地址