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

测试网页

相关推荐
蜡台31 分钟前
Python包管理工具pip完全指南-----2
linux·windows·python
^—app56686643 分钟前
游戏运存小启动不起来临时解决方法
运维·服务器
Ujimatsu1 小时前
虚拟机安装Debian 13.x及其常用软件(2026.4)
linux·运维·ubuntu
千百元1 小时前
zookeeper启不来了
linux·zookeeper·debian
志栋智能2 小时前
超自动化安全:构建智能安全运营的核心引擎
大数据·运维·服务器·数据库·安全·自动化·产品运营
AnalogElectronic3 小时前
linux 测试网络和端口是否连通的命令详解
linux·网络·php
Edward111111113 小时前
4月28日防火墙问题
linux·运维·服务器
想学后端的前端工程师4 小时前
【补充内外网突然不通的情况】
运维·服务器
子琦啊4 小时前
【算法复习】字符串 | 两个底层直觉,吃透高频题
linux·运维·算法