Understand the location and root nginx

Research monkey Xiao Liu 2022-08-06 07:53:03 阅读数:699

understandlocationrootnginx

1. If you understand location and root

insert image description here
When user enters localhost:8080/ , it will first match the location /
that is arrow 1 points, and thenGo to root and look for the root directory /home/www that is the direction of arrow 2,
In conclusion, when the userWhen you enter localhost:8080/ in the browser (of course you don't add / and also access the root directory/ by default), nginx will send /home/www/Find resources

2. Still Image

1. First create a new folder named /images in the /home/www/ directory,
Then configure location /images/ { root /home/www;}
Then when we are in the browserWhen entering localhost:8080/images/xxx.jpg , we can access the host under /home/www/images/Image file

版权声明:本文为[Research monkey Xiao Liu]所创,转载请带上原文链接,感谢。 https://qdmana.com/2022/218/202208060745357028.html