Web服务器 多IP访问网站

Web服务器 多IP访问网站

操作

1.关闭防火墙

复制代码
[root@localhost xzy]# systemctl stop firewalld
[root@localhost xzy]# setenforce  0

2.安装nginx(已安装)

复制代码
[root@localhost xzy]# yum install nginx
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 2:36:57 ago on Sun 20 Oct 2024 02:49:14 PM CST.
Package nginx-1:1.20.1-14.el9_2.1.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

3.使用nmuti创建IP

复制代码
[root@localhost xzy]# nmcli connection up ens160

4.创建text文件并配置文件

复制代码
server {
        listen 192.168.194.200:80;
        root /www/ip/200;
        location / {
                    index 200.html;
        }
}
server {
        listen 192.168.194.250:80;
        root /www/ip/250;
        location / {
                    index 250.html;
        }
}

5.创建文件并填写表示内容

复制代码
[root@localhost xzy]# mkdir /www/ip/200 -pv
mkdir: created directory '/www'
mkdir: created directory '/www/ip'
mkdir: created directory '/www/ip/200'
[root@localhost xzy]# mkdir /www/ip/250 -pv
mkdir: created directory '/www/ip/250'

[root@localhost xzy]# echo xzy200 > /www/ip/200/200.html
[root@localhost xzy]# echo xzy250 > /www/ip/250/250.html

[root@localhost xzy]# systemctl restart nginx
重启nginx

结果

相关推荐
无言听风雨丶22 分钟前
Linux 容器本质探秘:Cgroup 与 Namespace 深度解析与实战
linux·运维·服务器·kubernetes
Highcharts.js24 分钟前
React 中原生支持使用 JSX 组件配置自定义表格 Highcharts Grid
前端·javascript·react.js·前端框架·jsx·highcharts·自定义表格
数字新视界38 分钟前
机房动环监控系统在提升数据中心能效与安全中的应用探索
大数据·服务器·数据库·动环监控系统·动力与环境监控系统
薛定谔的猫-菜鸟程序员1 小时前
Electron开发超详细教程(从入门到放弃)
前端·javascript·electron
默|笙1 小时前
【Linux网络】传输层协议TCP(3)滑动窗口、流量控制
linux·网络·tcp/ip
最强小杰1 小时前
DeepSeek V4 Flash + Codex CLI 接入教程:原生 Responses API 适配,从配置到跑通收藏这篇就够了(2026)
java·前端·python·ai
静水leo2 小时前
使用 Whistle 拦截接口并模拟后端响应
前端
掘金者阿豪2 小时前
SQL Server数据迁移完成后,凌晨的数据库告警该怎么查?
前端·后端
JudithHuang2 小时前
React 嵌套路由与布局
前端·react.js·arcgis·react·react router