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
to access zuiyu
project
location /zuiyu { root html; index index.html; } location /zuiyu { alias html/zuiyu; index index.html; }
accesstest
project
location /test { root html; index index.html; } location /test { alias html/test; index index.html; }
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!