实验6 基于端口和域名的虚拟主机

1.添加server,并且给其中一台添加location

vim /etc/nginx/nginx.conf

2.添加域名

mim /etc/hosts

3.创建虚拟机发布目录

mkdir /web

mkdir /web/lsl

mkdir /web/lsl2

echo "this lsl port is 90" > /web/lsl/index.html

echo "this lsl port is 100" > /web/lsl2/index.html

cp /usr/share/nginx/html/poweredby.png /web/lsl/1.png

检查配置文件确认与否

nginx -t

nginx -s reload

测试结果

相关推荐
大胡子大叔13 小时前
docker pull命令拉取镜像失败的解决方案
运维·docker·容器
码农水水13 小时前
从 OpenFeign 到 RestClient:Spring Cloud 新时代的轻量化 HTTP 调用方案
java·运维·后端·spring·http·spring cloud·面试
Li_Zhi_Yao13 小时前
linux下qt快速搭建环境
linux·运维·qt
Hello.Reader13 小时前
Flink 弹性伸缩(Elastic Scaling)Adaptive Scheduler、Reactive Mode 与外部资源声明
服务器·网络·flink
Acrelhuang13 小时前
工厂配电升级优选 安科瑞智能断路器安全提效又节能-安科瑞黄安南
大数据·运维·开发语言·人工智能·物联网
Go_Zezhou13 小时前
render快速部署网站和常见问题解决
运维·服务器·开发语言·python·github·状态模式
小白电脑技术14 小时前
如何修改电脑名称及其实际作用
运维·网络·电脑
酣大智14 小时前
TCP与UDP协议
运维·网络·网络协议·tcp/ip
Sylvan Ding14 小时前
Clawdbot (OpenClaw/Moltbot) 内网穿透部署方案(安全有效-Linux-2026.01.30)
linux·运维·安全·tailscale·clawdbot·moltbot·openclaw
cyber_两只龙宝14 小时前
haproxy--实现能7层负载均衡、基于cookie会话保持、状态页监控的高性能web服务器集群
linux·运维·负载均衡·监控·haproxy·会话保持·高性能集群