知识卡片
root与alias路径不同
root把完整请求URI追加到指定目录;alias用指定路径替换命中的location前缀。例如location /conf/中请求/conf/nginx.conf,root /srv会映射到/srv/conf/nginx.conf,alias /srv/则映射到/srv/nginx.conf。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
原书出处
参考来源
- 位置:《深入理解Nginx:模块开发与架构解析(第2版)》第2章《Nginx的配置》2.4节(源文件:_epub-src/EPUB/text00016.html)
- 结论依据:原书2.4.2对比两种路径映射;[Nginx官方root文档](https://nginx.org/en/docs/http/ngx_http_core_module.html#root)和[alias文档](https://nginx.org/en/docs/http/ngx_http_core_module.html#alias)核对当前语义。
- 原始内容:root则不然,它会根据完整的URI请求来映射