0
点赞
收藏
分享

微信扫一扫

nginx配置文件root 与 alias的区别

假如服务器路径为:/home/imooc/files/img/face.png

root 路径完全匹配访问

配置的时候为:

location /imooc { 
	root /home 
}

用户访问的时候请求为: url:port/imooc/files/img/face.png

alias 可以为你的路径做一个别名,对用户透明

配置的时候为:

location /hello { 
	root /home/imooc 
}

用户访问的时候请求为: url:port/hello/files/img/face.png ,如此相当于为目录 imooc 做一个自定义的别名。

举报

相关推荐

0 条评论