安装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       #重启
相关推荐
Sthenia31 分钟前
如何用 Chrome DevTools 定位 Long Task:一份从零到实战的排查笔记
前端·性能优化
刺客xs1 小时前
TCP网络通信
网络·网络协议·tcp/ip
xinyu_Jina1 小时前
Calculator Game:WebAssembly在计算密集型组合优化中的性能优势
前端·ui·性能优化
不染尘.3 小时前
TCP客户服务器编程模型
linux·服务器·网络·网络协议·tcp/ip·计算机网络·ssh
ssshooter3 小时前
为什么移动端 safari 用 translate 移动元素卡卡的
前端·css·性能优化
irisart4 小时前
第二章【NGINX 开源功能】—— 七层反向代理(上)
运维·nginx
Knight_AL5 小时前
视图 vs 临时表:它们的差异、适用场景与性能优化
性能优化
single375 小时前
Nginx 生产环境平滑升级实战:从 1.24.0 到 1.28.0 的零宕机操作全记录
nginx
程序员小寒5 小时前
前端性能优化之Webpack篇
前端·webpack·性能优化
·云扬·6 小时前
MySQL服务器性能优化:硬件与存储配置全指南
服务器·mysql·性能优化