安装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       #重启
相关推荐
JQShan2 小时前
同步的 defer,异步的陷阱:Swift 并发中加载动画关不掉的调试实录
性能优化·swift
AI+程序员在路上2 小时前
网桥及IP转发在嵌入式linux eth0与wlan0连接使用方法
linux·tcp/ip·php
侑虎科技2 小时前
UE是怎么管理纹理的各向异性采样的
性能优化·gpu
松涛和鸣5 小时前
41、Linux 网络编程并发模型总结(select / epoll / fork / pthread)
linux·服务器·网络·网络协议·tcp/ip·算法
秋雨雁南飞6 小时前
Nginx安装
nginx
Tandy12356_7 小时前
手写TCP/IP协议栈——TCP结构定义与基本接口实现
c语言·网络·c++·网络协议·tcp/ip·计算机网络
FGGIT8 小时前
BoostKit 大数据 OmniRuntime 性能优化原理分析
大数据·性能优化
一颗青果8 小时前
Socket编程(TCP)
网络·网络协议·tcp/ip
m0_672656549 小时前
JavaScript性能优化实战技术文章大纲
开发语言·javascript·性能优化
理智的煎蛋9 小时前
单节点 K8S IP 修改步骤
tcp/ip·云原生·容器·kubernetes