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测试本地

测试网页

相关推荐
努力努力再努力wz4 分钟前
2025年度总结:不断迈出第一步
linux·运维·服务器·数据结构·redis·python·django
lbb 小魔仙6 分钟前
【Linux】嵌入式 Linux 从入门到精通:设备树配置 + 驱动优化核心教程
linux·运维·服务器
..过云雨12 分钟前
计算机网络核心概述:网络通信协议及传输流程深度解析
linux·c++·网络协议·tcp/ip·计算机网络
QT 小鲜肉21 分钟前
【Linux命令大全】003.文档编辑之comm命令(实操篇)
linux·运维·服务器·javascript·chrome·笔记
Microsoft Word26 分钟前
Linux零基础入门
linux·运维·服务器
QT 小鲜肉31 分钟前
【Linux命令大全】002.文件传输之lpd命令(实操篇)
linux·运维·服务器·网络·chrome·笔记
..过云雨34 分钟前
TCP/IP网络传输的基本要素剖析
linux·网络·网络协议·tcp/ip
一个平凡而乐于分享的小比特1 小时前
Ubuntu下TFTP与FTP服务详解
linux·ubuntu·ftp·tftp
haluhalu.1 小时前
Linux--System V 共享内存完全指南:从原理到实践
linux·运维·服务器