[root@localhost ~]# systemctl stop firewalld 关闭防火墙
[root@localhost ~]# setenforce 0 变更为“permissive”模式
[root@localhost ~]# nmcli connection modify ens160 ipv4.addresses 192.168.62.100/24 +ipv4.addresses 192.168.62.200/24 ipv4.gateway 192.168.63.255 ipv4.dns 8.8.8.8 设置多地址192.168.62.100/24、192.168.62.200/24
server {
listen 192.168.62.100:80; 监听地址
root /www/100; 文件路径
location / {
index index.html; 具体文件
}
}
server{
listen 192.168.62.200:80;
root /www/200;
location / {
index index.html;
}
}
[root@localhost ~]# mkdir /www/{100,200} -pv 创建文件
mkdir: created directory '/www/100'
mkdir: created directory '/www/200'
[root@localhost ~]# echo woshi 192.168.62.100 > /www/100/index.html 写入文件
[root@localhost ~]# echo woshi 192.168.62.200 > /www/200/index.html
[root@localhost ~]# systemctl restart nginx.service 重启nginx服务
[root@localhost ~]# curl 192.168.62.100 访问网站
woshi 192.168.62.100
[root@localhost ~]# curl 192.168.62.200
woshi 192.168.62.200