Home  >  Article  >  Backend Development  >  The usage of Nginx's alias and the difference between it and root

The usage of Nginx's alias and the difference between it and root

WBOY
WBOYOriginal
2016-07-29 09:02:011130browse

The usage of Nginx’s alias and the difference from 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

I used to only know how to use root in the location block of Nginx, but I always felt that using it could not satisfy some of my own ideas. Then I finally discovered alias.

Let’s look at the usage of toot first

<code>location <span>/request_path/image/</span> {
    root <span>/local_path/image/</span>;
}</code>

The result of this configuration is that when the client requests /request-path/image/cat.png,
Nginx maps the request to /local_path/image/request-path/image/cat.png

Look at the usage of alias

<code>location /request_path/<span>image</span>/ {
    <span>alias</span> /local_path/<span>image</span>/;
}</code>

At this time, when the client requests /request-path/image/cat.png,
Nginx maps the request to /local_path/image/cat.png
You can know how to use it by comparing root~~ :)

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces the usage of Nginx's alias and the difference with root, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn