安装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       #重启
相关推荐
子兮曰10 小时前
🔥深度解析:Nginx目录浏览美化与功能增强实战指南
前端·javascript·nginx
鼠鼠我捏,要死了捏11 小时前
Caffeine 本地缓存最佳实践与性能优化指南
缓存·性能优化·caffeine
xiaoxiongip66611 小时前
动态ip适合挂什么项目
网络·爬虫·python·网络协议·tcp/ip·ip
佛珠散了一地12 小时前
【qt】通过TCP传输json,json里包含图像
qt·tcp/ip·json
LaoZhangGong12313 小时前
了解RJ45插座和水晶头网线
网络·tcp/ip·智能路由器·rj45
七夜zippoe1 天前
分布式事务性能优化:从故障现场到方案落地的实战手记(二)
java·分布式·性能优化
zhao3266857511 天前
海外代理IP平台Top3评测:LoongProxy、神龙动态IP、IPIPGO哪家更适合你?
服务器·网络·tcp/ip
好好沉淀1 天前
从两分钟到毫秒级:一次真实看板接口性能优化实战(已上线)
性能优化
会飞的鱼_1231 天前
Nginx性能优化与防盗链实战指南
运维·nginx·性能优化
XMZH030421 天前
网络编程;TCP控制机械臂;UDP文件传输;0910;ps今天没写出来
网络·tcp/ip·udp