nginx指定文件路径有两种方式'root'和'alias'
root会根据完整的URI请求来映射
alias会把'location'后面配置的路径丢弃掉,把当前匹配到的目录指向到指定的目录
语法 root path
默认值 root html
配置段 http、server、location、if
--请求的'uri'是'/image/icon.png'时,服务器将会返回服务器上的'/www/image/icon.png'文件
location / {
root /www;
}
语法 alias path
配置段 location
--请求的'uri'是'/image/icon.png'时,服务器将会返回服务器上的'/www/icon.png'文件
location / {
alias /www;
}
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有