首页 > 运维 > nginx > Nginx中root与alias区别是什么

Nginx中root与alias区别是什么

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
发布: 2023-05-16 17:31:14
转载
1325 人浏览过

项目结构

Nginx 目录结构如下:html下为部署的前端项目页面,分别为zuiyutest,下面我将通过使用rootalias来访问

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;
  }
登录后复制

总结

通过上面两个小例子,相信大家也已经看出来rootalias的区别了,不错alias就是别名,也就是使用alias配置项目地址的时候,可以直接配置到访问的项目文件夹,而使用root配置时,Nginx 会在的默认部署路径html下找到匹配uri中的文件夹,然后在该文件夹下查找index.html

以上是Nginx中root与alias区别是什么的详细内容。更多信息请关注PHP中文网其他相关文章!

相关标签:
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
为什么root登录失败
来自于 1970-01-01 08:00:00
0
0
0
root用户的密码是多少
来自于 1970-01-01 08:00:00
0
0
0
User 'root'@'localhost' 拒绝访问 - 权限不足?
来自于 1970-01-01 08:00:00
0
0
0
linux - nginx以非root权限启动
来自于 1970-01-01 08:00:00
0
0
0
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板