安装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       #重启
相关推荐
这是个栗子6 小时前
【前端性能优化】优化数据加载:用 Promise.all 从串行到并行
前端·javascript·性能优化·异步编程·前端优化·promise.all
AI服务老曹8 小时前
国产NPU视觉算法参数配置说明
算法·性能优化·边缘计算
大数据009 小时前
画像标签系统性能优化:SelectDB 字符串解析函数实战与 Profile 深度剖析
性能优化·doris·selectdb·画像标签
huainingning9 小时前
华三ACL单向TCP互通组网-通过Established状态回包实现
运维·网络·tcp/ip
工业HMI实战笔记10 小时前
工业HMI界面布局“1核2辅”黄金结构,适配90%场景
前端·ui·性能优化·自动化·交互
ai产品老杨13 小时前
多路摄像头AI分析性能优化指南
人工智能·性能优化
黑黑的独立开发笔记14 小时前
「 简记往来」第十五篇:小程序性能优化——首屏从2.5秒到1.2秒
性能优化·小程序·首屏优化·分包加载·setdata·简记往来
阿标在干嘛17 小时前
政策快报爬虫的生存指南:IP池、浏览器模拟、验证码识别实战
爬虫·网络协议·tcp/ip
M1582276905519 小时前
协议互通利器|SG-TCP-COE-210 Modbus TCP 转 CANOpen 网关,低成本打通以太网与运动总线
服务器·网络·tcp/ip
天启HTTP19 小时前
开启代理后访问变慢,是IP问题还是线路问题
网络·tcp/ip