安装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       #重启
相关推荐
笨笨狗吞噬者4 小时前
【uniapp】体验优化:开源工具集 uni-toolkit 发布
性能优化·微信小程序·uni-app
foundbug9996 小时前
查看nginx日志文件
linux·nginx·github
智能化咨询7 小时前
基于Spring Boot + Vue 3的乡村振兴综合服务平台性能优化与扩展实践
vue.js·spring boot·性能优化
一只程序烽.8 小时前
java项目使用宝塔面板部署服务器nginx不能反向代理找到图片资源
java·服务器·nginx
去往火星10 小时前
QML Profiler性能优化教程
性能优化
盛满暮色 风止何安11 小时前
防火墙的类别和登录Web的方法
linux·运维·服务器·网络·网络协议·tcp/ip·网络安全
福大大架构师每日一题11 小时前
nginx 1.29.2 发布:AWS-LC 支持、QUIC及SSL优化等重要更新
nginx·ssl·aws
立方世界12 小时前
HTML编写规则及性能优化深度解析:从基础到企业级实践
前端·性能优化·html
夕泠爱吃糖13 小时前
TCP中的拥塞控制
网络·tcp/ip·智能路由器·拥塞控制
DemonAvenger15 小时前
Redis Geo 深度解析:从原理到实战,带你玩转地理位置计算
数据库·redis·性能优化