【Linux&Centos8】HTTP服务器配置

实验需求

Web服务器主要实现的功能是能使Internet网络通过域名访问公司网站并建立起财务,销售,以及人事部门的部门网站,各个部门的网站通过基于虚拟主机实现,财务部因为涉及到公司财务安全,所以要求通过身份认证才能进行访问,具体域名需要在DNS中进行设置。

实验步骤与解析

  1. 第一步:安装http软件包
yum install httpd -y
  1. 第二步:修改 /etc/httpd/conf/httpd.conf
vim /etc/httpd/conf/httpd.conf
  1. 第三步: 创建新配置文件:/etc/httpd/conf.d/vhost.conf
vim /etc/httpd/conf.d/vhost.conf
  1. 第四步:创建用户首页目录
  2. 第五步:设置 SELinux 上下文
chcon -t httpd_sys_content_t /www/ -R
  1. 第六步:创建认证用户 user1
htpasswd -c /etc/httpd/conf.d/.htpasswd user1
  1. 第七步:重启 httpd 服务,设置防火墙
systemctl restart httpd
systemctl enable httpd
firewall-cmd --permanent --add-service=http
firewall-cmd --reload
  1. 第八步:验证访问 浏览器中:输入 xiaoshou.ibossay.com caiwu.ibossay.com
  2. 结束!!!(●’◡’●)
经验分享 程序员 微信小程序 职场和发展