安装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       #重启
相关推荐
木易士心14 分钟前
Vue 3 内存泄漏排查与性能优化:从入门到精通的工具指南
性能优化
程思扬36 分钟前
你的模型你做主:Fooocus + cpolar,安全远程生成 AI 图像
人工智能·笔记·tcp/ip·前端框架·figma·蓝湖
根哥的博客1 小时前
编译nginx-1.28.0支持lua语法
nginx·lua·openresty·nosql注入漏洞
中杯可乐多加冰1 小时前
openEuler网络优化:TCP/IP协议栈性能深度测评
网络·网络协议·tcp/ip·计算机网络·openeuler
虎头金猫1 小时前
openEuler 22.03 LTS 时序数据库实战:InfluxDB 深度性能评测与优化指南
网络·数据库·python·网络协议·tcp/ip·负载均衡·时序数据库
Yan-英杰1 小时前
openEuler 数据库性能深度评测:PostgreSQL 全方位压测
网络·人工智能·网络协议·tcp/ip·http
qq_5470261791 小时前
Docker 搭建 Nginx 服务
nginx·docker·容器
中杯可乐多加冰1 小时前
openEuler软件生态体验:快速部署Nginx Web服务器
服务器·前端·nginx
邪恶喵喵1 小时前
nginx反向代理和负载均衡
运维·nginx·负载均衡
车载测试工程师2 小时前
CAPL学习-SOME/IP交互层-回调函数
学习·tcp/ip·交互·以太网·capl·canoe