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

测试网页

相关推荐
努力学习的小廉26 分钟前
深入了解linux网络—— 自定义协议(上)
linux·服务器·网络
bcgbsh1 小时前
Linux开机启动脚本(cron 的 @reboot 特性)
linux·cron
听风吹雨yu1 小时前
RK3588从数据集到训练到部署YoloV8
linux·yolo·开源·rk3588·rknn
野犬寒鸦1 小时前
从零起步学习Redis || 第十一章:主从切换时的哨兵机制如何实现及项目实战
java·服务器·数据库·redis·后端·缓存
iconball2 小时前
个人用云计算学习笔记 --19 (MariaDB服务器)
linux·运维·笔记·学习·云计算
Lynnxiaowen2 小时前
今天我们开始学习python3编程之python基础
linux·运维·python·学习
Chandler242 小时前
一图掌握 操作系统 核心要点
linux·windows·后端·系统
dragoooon343 小时前
[Linux系统编程——Lesson6.进程切换与调度]
linux·运维·服务器
waves浪游3 小时前
Linux基本指令(下)
linux·运维·服务器
K_i1344 小时前
探索Linux:开源世界的钥匙
linux