最近,我学习了nginx.I,我无法理解下面的路由configuration.Can,有人解释了吗?谢谢!
root /home/ubuntu/demo/web_file;
location / {
root /home/ubuntu/demo/web_file/production;
index index.html index.htm;
}
location /vendors {
index index.html index.htm;
}
location /src {
index index.html index.htm;
}
location /build {
index index.html index.htm;
}发布于 2018-10-22 09:46:15
root指令的值是从周围的块继承的,如果没有在location本身中指定它。详情请参见本文件。
location /块实际上是默认位置,并匹配与其他location块不匹配的任何URI。
在您的配置中,您将所有URI的根指定为/home/ubuntu/demo/web_file/production,但以/vendors、/src或build开头的URI除外。
您不需要在每个位置重复相同的index语句,因为如果它不是在location本身中指定的,那么它也是从周围的块继承的。详情请参见本文件。
例如:
root /home/ubuntu/demo/web_file;
index index.html index.htm;
location / {
root /home/ubuntu/demo/web_file/production;
}
location /vendors {
}
location /src {
}
location /build {
}https://stackoverflow.com/questions/52925905
复制相似问题