一. 安装Apache软件包
使用yum在线安装:
命令:[root@Server ~]#yum install httpd -y
二. 创建子公司网站目录和网页文件
创建目录/www/http/sub1和/www/http/sub2
[root@Server ~]#mkdir /www/http/sub1 /www/http/sub2
创建首页文件index.html
[root@Server ~]#echo "This is sub1 web pages" >> /www/http/sub1/index.html
[root@Server ~]#echo "This is sub2 web pages" >> /www/http/sub2/index.html
三. 编辑Web服务主配置文件
1. 备份主配置文件
[root@Server conf]#cp httpd.conf httpd.conf.bak
2. 编辑主配置文件
[root@Server conf]#vi httpd.conf
增加Alias别名
Alias /sub1 "/var/www/sub1"
<Directory "/var/www/sub1">
AllowOverride None
Require all granted
</Directory>
Alias /sub2 "/var/www/sub2"
<Directory "/var/www/sub2">
AllowOverride None
Require all granted
</Directory>
四. 开启Web服务
[root@Server conf]#systemctl start httpd
五. 设置防火墙和Selinux
1.防火墙规则添加ftp服务:firewall-cmd --permanent --add-service=http
2.更新规则:firewall-cmd --reload
3.查看防火墙放行的服务:firewall-cmd --list-all
4.设置selinux为permissive:setenforce 0
六. 客户端使用浏览器访问
浏览器输入网址:http://web服务器IP/sub1和http://web服务器IP/sub2