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

测试网页

相关推荐
@atweiwei6 小时前
LangChainRust 0.33.0 发布:让 Agent 应用更容易运行、观察和评测
服务器·前端·javascript
工业一体机老司机6 小时前
rsync+inotify 收集车间工位机日志的完整配置
服务器·数据库·postgresql
西柚小萌新6 小时前
【人工智能:LangGraph】--3.控制流(Edge)
java·服务器·数据库
胜心缘7 小时前
openEuler 24.03 最小安装后的第一个小时:10 组命令,一份基线清单
linux·运维
胜心缘7 小时前
openEuler 装 nginx:别再开 EPOL 了,它根本不在里面
linux·运维
用户8174480063397 小时前
从零搭建并加固个人博客:阿里云轻量服务器 + Hexo + Nginx 全流程实战
linux
飞奔的瓜牛8 小时前
Nginx + HAProxy 实现 TCP 代理:架构设计与实战配置
运维·tcp/ip·nginx
老一岁9 小时前
Redis事务_锁_持久化_主从哨兵
linux·数据库·redis
梓沂9 小时前
零成本替代 FTP:Ubuntu 24.04 搭建 Samba 共享,实现“一人可写,多人只读”
linux·运维·ubuntu
EmbeddedChen9 小时前
Linux 定时任务怎么设置?用 cron 自动执行脚本
linux·crontab·cron