Home > Operation and Maintenance > Nginx > What is the difference between root and alias in Nginx

What is the difference between root and alias in Nginx

WBOY
Release: 2023-05-16 17:31:14
forward
1262 people have browsed it

Project structure

The Nginx directory structure is as follows: html is the deployed front-end project page, respectively zuiyu and test, below I will access <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:plain;">nginx --conf --logs --html --zuiyu --index.html --static --test --index.html --static</pre><div class="contentsignin">Copy after login</div></div>test by using

root

and

alias

to access zuiyuproject

  location /zuiyu {
    root html;
    index index.html;
  } 
  location /zuiyu {
    alias html/zuiyu;
    index index.html;
  }
Copy after login

accesstestproject

 location /test {
    root html;
    index index.html;
  } 
  location /test {
    alias html/test;
    index index.html;
  }
Copy after login

Summary

Through the above two small examples, I believe everyone has also seen that root and alias# The difference between ##, yes alias is an alias, that is, when using alias to configure the project address, you can directly configure it to the accessed project folder, and use rootWhen configuring, Nginx will find the folder matching uri under the default deployment path html, and then search for index.html under the folder.

The above is the detailed content of What is the difference between root and alias in Nginx. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template