多ip访问网站

多ip访问网站

安装nginx

复制代码
[root@localhost ~]# dnf install nginx -y

关闭防火墙,sulinux

复制代码
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0

添加多IP(这里使用图形化模式)

复制代码
[root@localhost ~]# nmtui
[root@localhost ~]# nmcli connection up ens160




撰写配置文件

复制代码
[root@localhost ~]# vim /etc/nginx/conf.d/test_ip.conf
server {
        listen 192.168.36.100:80;
      # server_name
        root /test/100;
        location / {
                index index.html;
        }
}
server{
        listen 192.168.36.200:80;
        #server_name
        root /test/200;
        location / {
                index index.html;
        }
}

创建存放ip显示内容的目录

复制代码
[root@localhost ~]# mkdir /test/{100,200} -pv

像两个ip网页写入内容

复制代码
[root@localhost ~]# echo this is 1 > /test/100/index.html
[root@localhost ~]# echo this is 2 > /test/200/index.html

重启nginx服务

复制代码
[root@localhost ~]# systemctl restart nginx

测试

复制代码
[root@localhost ~]# curl 192.168.36.100
this is 1
[root@localhost ~]# curl 192.168.36.200
this is 2


相关推荐
大虾别跑16 分钟前
麒麟v10搭建rsync
linux·运维·服务器
自动化智库18 分钟前
西门子XB208网管型交换机使用方法
运维·服务器·网络
CDN36021 分钟前
CSDN 运维笔记|360CDN 高防服务器配置与防护规则
运维·服务器·笔记
爱学习的小囧21 分钟前
VCF 集群部署灵活组合:单节点与高可用配置完全指南
java·服务器·前端
BullSmall24 分钟前
LVS与HAProxy高可用负载方案详解
linux·服务器·网络
docsz27 分钟前
Flink-1.20集群部署
linux·服务器·flink
行思理30 分钟前
Linux查看网站访问IP的命令大全
linux·服务器·前端
Rondox39 分钟前
wake on lan 电脑局域网内远程开机
服务器·网络·电脑
Saniffer_SH41 分钟前
【高清视频】实验室搭建PCIe 6.0测试环境需要的retimer卡介绍
服务器·驱动开发·测试工具·fpga开发·计算机外设·硬件架构·压力测试
爱钓鱼的程序员小郭1 小时前
阿里云自动配置安全组IP白名单
python·tcp/ip·安全·阿里云