提供单个文件,而不考虑nginx中的位置匹配
我当前的配置是提供单个文件,而不考虑nginx中的位置匹配,nginx,Nginx,我当前的配置是 server{ listen 80; server_name some.com; location /{ root /var/www; index index.html; } } 这和 /->/var/www/index.html /container->/var/www/container/index.html 我希望位置匹配不会附加到根。因此,匹配将是 /->/var/www/index.html /contai
server{
listen 80;
server_name some.com;
location /{
root /var/www;
index index.html;
}
}
这和
/
->/var/www/index.html
/container
->/var/www/container/index.html
我希望位置匹配不会附加到根。因此,匹配将是
/
->/var/www/index.html
/container
->/var/www/index.html
无论位置如何,它都是相同的,我将动态处理渲染。通常的方法是使用
try\u files
提供默认URI:
server{
listen 80;
server_name some.com;
root /var/www;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
有关详细信息,请参阅