安装nginx实现多ip访问多网站

一.首先安装nginx

c 复制代码
[root@server nginx]# systemctl stop firewalld   关防火墙
[root@server nginx]# setenforce 0    关selinux
[root@server nginx]# mount /dev/sr0 /mnt   挂载点
[root@server nginx]# dnf install nginx -y   安装nginx

二,添加地址

c 复制代码
[root@server nginx]# setenforce 0               #关闭selinux

[root@server nginx]# nmtui                    #写多IP

切换手动模式

将ip改为192.168.146.129和192.168.146.130

c 复制代码
[root@server nginx]# nmcli connection up ens160  #重启nmtui
[root@server nginx]# ip a   检验

编辑html

c 复制代码
[root@server nginx]#vim /etc/nginx/conf.d/test_ip.conf #编辑
[root@server nginx]# mkdir /test/{100,129,200} -pv #创建文件
[root@server nginx]# echo this is 130 > /test/129/index.html

[root@server nginx]# echo this is 139 > /test/100/index.html

[root@server nginx]# echo this is 140 > /test/200/index.html #根据配置在主机创建数据文件

[root@server nginx]# systemctl restart nginx       #重启
相关推荐
zz-zjx2 小时前
LVS NAT/DR 模式 负载均衡Keepalive 高可用+DR
网络协议·tcp/ip·lvs
ttthe_MOon2 小时前
动静分离 + 负载均衡:Nginx 与 Tomcat 深度整合实战
nginx·tomcat·负载均衡
凯子坚持 c7 小时前
Docker实战深度解析:从Nginx部署到私有镜像仓库管理
nginx·docker·eureka
谢尔登9 小时前
通用会话控制方案
前端·网络协议·tcp/ip·react.js·gitlab
老蒋新思维9 小时前
借陈修超之智,搭建 AI 与 IP 的创新增长桥梁|创客匠人
网络·人工智能·网络协议·tcp/ip·ip·知识付费·创客匠人
重启编程之路10 小时前
python 基础学习socket -TCP编程
网络·python·学习·tcp/ip
老蒋新思维11 小时前
陈修超入局:解锁 AI 与 IP 融合的创新增长密码
网络·人工智能·网络协议·tcp/ip·企业管理·知识付费·创客匠人
xxtzaaa12 小时前
告别IP关联烦恼,多部手机如何实现不同IP防封号
网络·网络协议·tcp/ip
lwhdjbcjdjd12 小时前
Nginx与Tomcat协作处理流程及数据流向
运维·nginx·tomcat
tang7778913 小时前
代理IP的匿名性测试:如何验证你的真实IP是否已泄露?
网络·网络协议·tcp/ip