1、配置好网卡信息(多IP访问),即每个域名有自己的IP地址,启动http服务
nmcli connection modify ens160 ipv4.method manual ipv4.addresses 192.168.190.186/24 +ipv4.addresses 192.168.190.109/24 +ipv4.addresses 192.168.190.247/24 ipv4.gateway 192.168.190.2 ipv4.dns 114.114.114.114 connection.autoconnect yes
#信息解读:
#使用nmcli 命令修改名为ens160的网卡 ipv4连接方法为 手动 ipv4地址为192.168.190.186/24 以及ipv4地址 192.168.190.109/24 和ipv4地址为192.168.190.247/24 设置网关为 192.168.190.2 设置ipv4的DNS 地址为 114.114.114.114 开启自动连接 是的
2、启动网卡ens160
nmcli connection up ens160
3、关闭防火墙
systemctl stop firewalld
setenforce 0
4、启动http服务
systemctl start httpd
解题步骤:
1、创建目录文件
mkdir /www/{xiaopang,dapang}
写入文件内容
echo 小胖,你咋这么胖呢! > /www/xiaopang/index.html
echo 大胖,你也一样! > /www/dapang/index.html
3、编辑网页配置文件
vim /etc/httpd/conf.d/vhost.conf
4、设置网页配置文件
<Directory /www>
AllowOverride none
Require all granted
</Directory>
<VirtualHost 192.168.190.109:80>
ServerName www.xiaopang.com
DocumentRoot /www/xiaopang
</VirtualHost>
<VirtualHost 192.168.190.247:80>
ServerName www.dapang.com
DocumentRoot /www/dapang
</VirtualHost>
5、编辑linux操作系统缓存文件
vim /etc/hosts
6、配置文件内容
192.168.190.109 www.xiaopang.com
192.168.190.247 www.dapang.com
7、重启http服务
systemctl restart httpd