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

测试网页

相关推荐
怀旧,7 分钟前
【Linux网络编程】9. 数据链路层
linux·服务器·网络
QotomPC19 分钟前
Qotom Q30900GP多网口Mini PC:16网口设计在pfSense与工业网络中的应用
服务器·网络·边缘计算
用户23678298016824 分钟前
Linux watch 命令深度解析:从实时监控到变化检测的完整实现
linux
Liangwei Lin1 小时前
LeetCode 22. 括号生成
linux·运维·服务器
win水1 小时前
八、命令行参数和环境变量
linux·环境变量·命令行参数
( •̀∀•́ )9201 小时前
Linux 下部署 `social-auto-upload` 遇到的问题及完整解决方案
linux·运维·服务器
高锰酸钾_1 小时前
计算机网络-链路层-差错控制
服务器·网络·计算机网络
代码中介商1 小时前
Libevent实战:高性能网络编程指南
linux·运维·网络
happytree0011 小时前
linux0.11 - setup.s第一阶段(获取系统信息)
linux
怀旧,1 小时前
【Linux网络编程】2. Socket编程 UDP
linux·网络·udp