安装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       #重启
相关推荐
小天源3 小时前
从 Nginx 日志到访问分析:轻量化网站监测服务的架构实践
jvm·nginx·网络安全·架构·网络监控
小天源4 小时前
让访问数据可解释:IP 地球大屏、地区库更新与运行维护设计
网络·网络协议·tcp/ip
9527出列5 小时前
基于oss的断点续传实现
http·性能优化
万联WANFLOW5 小时前
拆解 Meta Prometheus 网络:20,736 张 GPU 如何互联?4 个设计取舍值得关注
tcp/ip·meta·gpu
AliCloudROS6 小时前
从 1 万到 20 万:OOS Loop 任务规模提升 20 倍的攻坚记录
运维·性能优化
隐擎fox6 小时前
深入 Android 移动端风控与协议层对抗:内核级虚拟环境检测、网络堆栈特征伪装与住宅 IP 协同实战
android·网络·python·网络协议·tcp/ip
格叽格叽噗7 小时前
企业风控怎么落地IP核验?从IP查询字段到分级处置的3步法
tcp/ip
yunwei377 小时前
eBPF 示例:使用 CUPTI 构建 GPU 火焰图分析器
linux·后端·性能优化
打工仔折腾 AI8 小时前
从零开始大模型微调:基于 PyTorch 与 ChatGLM 的 LoRA 实践指南
人工智能·pytorch·后端·python·深度学习·性能优化·ai agent 实战
Cx330❀9 小时前
深入浅出 Qt 绘图机制:从 QPainter 到四大图像类解析
开发语言·qt·ui·性能优化·图形渲染