nginx的alias的用法及和root的区别
http://nginx.org/en/docs/http/ngx_http_core_module.html#alias http://nginx.org/en/docs/http/ngx_http_core_module.html#root
以前只知道Nginx的location块中的root用法,用起来总是感觉满足不了自己的一些想法。然后终于发现了alias这个东西。
先看toot的用法
<code>location <span>/request_path/image/</span> {
root <span>/local_path/image/</span>;
}</code>这样配置的结果就是当客户端请求 /request-path/image/cat.png 的时候,
Nginx把请求映射为/local_path/image/request-path/image/cat.png
再看alias的用法
<code>location /request_path/<span>image</span>/ {
<span>alias</span> /local_path/<span>image</span>/;
}</code>这时候,当客户端请求 /request-path/image/cat.png 的时候,
Nginx把请求映射为/local_path/image/cat.png
对比root就可以知道怎么用了吧~~ :)
以上就介绍了Nginx的alias的用法及和root的区别,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号