安装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       #重启
相关推荐
芝士雪豹只抽瑞克五5 小时前
Nginx 高性能Web服务器笔记
服务器·nginx
gihigo19985 小时前
基于TCP协议实现视频采集与通信
网络协议·tcp/ip·音视频
失重外太空啦6 小时前
nginx
运维·nginx
小马爱打代码6 小时前
MySQL性能优化核心:InnoDB Buffer Pool 详解
数据库·mysql·性能优化
顾青7 小时前
仅仅一行 CSS,竟让 2000 个节点的页面在弹框时卡成 PPT?
前端·vue.js·性能优化
龙仔7258 小时前
在麒麟V10服务器安全加固,sshd防暴力破解加固,实现“密码错误3次封IP”的需求
服务器·tcp/ip·安全
天蓝不会忘记028 小时前
lvs,haproxy,keepalived,nginx,tomcat介绍和实验
nginx·tomcat·lvs
山峰哥8 小时前
吃透 SQL 优化:告别慢查询,解锁数据库高性能
服务器·数据库·sql·oracle·性能优化·编辑器
feng68_9 小时前
Nginx高性能Web服务器
linux·运维·服务器·nginx
unfeeling_10 小时前
Nginx实验
运维·nginx