http——配置nginx服务通过ip访问多网站

关防火墙

systemctl stop firewalld

setenforce 0

安装挂载web

mount /dev/sr0 /mnt

dnf install nginx -y

启动web

systemctl start nginx

nmcli配置网卡

nmcli connection modify ens160 ipv4.method manual ipv4.addresses 192.168.182.100/24 +ipv4.addresses 192.168.182.200/24 ipv4.gateway 192.168.182.2 ipv4.dns 8.8.8.8

激活配置

nmcli connection up ens160

xshell更新连接ip后创建子配置文件并定义多个server模块

vim /etc/nginx/conf.d/test_ip.conf

创建对应目录文件

mkdir /test/{100,200} -pv

mkdir: created directory '/test'

mkdir: created directory '/test/100'

mkdir: created directory '/test/200'

echo test 100 > /test/100/index.html

echo test 200 > /test/200/index.html

重启服务

systemctl restart nginx

curl测试本地

测试网页

相关推荐
我星期八休息8 小时前
网络编程—NAT、代理服务与内网穿透
linux·服务器·网络·网络协议
RisunJan9 小时前
Linux命令-sysctl(运行时修改内核参数)
linux·网络·智能路由器
yunwei379 小时前
eBPF 教程:使用 fsession 追踪慢速 vfs_read 调用
linux·云原生
A_humble_scholar9 小时前
Linux 网络基础(三)下的 HTTP 核心详解:从请求响应到状态管
linux·网络·http
袅沫9 小时前
Nginx中部署多个前端项目——区分路径
服务器·前端
Albart5759 小时前
Docker Desktop最新版安装踩坑全记录(Windows_Mac_Linux)【2026 4.74.0 终版】
linux·windows·macos·docker·环境搭建·踩坑记录
fei_sun9 小时前
UVM中的TLM1.0通信
运维·服务器·uvm
MartinYeung59 小时前
[论文学习]MCPTox:面向真实世界MCP服务器的工具投毒攻击基准测试
运维·服务器·学习
举手10 小时前
Epoll模型
linux·c++·学习
Escalating_xu10 小时前
【Linux】基础 I/O 深度解析:FILE、文件描述符、open/read/write、重定向与缓冲区
java·linux·服务器