Nginx中root与alias区别是什么
作者:吹吹风会发光
时间:2025-03-25
来源:正软商城
浏览:5
项目结构Nginx目录结构如下:html下为部署的前端项目页面,分别为zuiyu和test,下面我将通过使用root和alias来访问nginx--conf--logs--html--zuiyu--index.html--static--test--index.html--static测试访问zuiyu项目location/zuiyu{roothtml;indexindex.html;}location/zuiyu{aliashtml/zuiyu;indexindex.html;}访问test项目loca
本文目录
项目结构
Nginx 目录结构如下:html下为部署的前端项目页面,分别为zuiyu和test,下面我将通过使用root和alias来访问
nginx --conf --logs --html --zuiyu --index.html --static --test --index.html --static
测试
访问zuiyu项目
location /zuiyu {
root html;
index index.html;
}
location /zuiyu {
alias html/zuiyu;
index index.html;
}访问test项目
location /test {
root html;
index index.html;
}
location /test {
alias html/test;
index index.html;
}总结
通过上面两个小例子,相信大家也已经看出来root和alias的区别了,不错alias就是别名,也就是使用alias配置项目地址的时候,可以直接配置到访问的项目文件夹,而使用root配置时,Nginx 会在的默认部署路径html下找到匹配uri中的文件夹,然后在该文件夹下查找index.html
作者最新文章
AO3官网中文入口最新地址公布
2026-11-19 10:44
AO3镜像网站一键入口链接
2026-11-18 13:04
手机修复PDF失败怎么办?PDF电脑修复怎么选
2026-11-18 12:23
腾讯文档误删内容怎么恢复历史版本 找回方法
2026-11-17 13:42
如何进入Wattpad?正版官方入口与中文用户网站入口说明
2026-11-16 17:02
下一篇:
飞书如何查看工资单-飞书查看工资单的方法
热门文章
更多
精品专题
更多
Mac软件
更多
火山引擎 网页版
Windows/ macOS/ Linux
火山引擎是字节跳动旗下企业级云与AI服务平台。聚焦大模型核心能力,依托字节自研豆包多模态大模型,凭借火山方舟一站式平台,提供模型精调、推理部署、智能应用搭建等全链路服务,结合高性能AI算力,助力各行业快速落地大模型数字化与智能化应用。
















