Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何通过nginx在不同位置提供不同的html文件?_Nginx - Fatal编程技术网

如何通过nginx在不同位置提供不同的html文件?

如何通过nginx在不同位置提供不同的html文件?,nginx,Nginx,我有两个html文件-index.html和promo.html 需要在/上提供index.html,在/promo上提供promo.html 尝试添加一个位置: location /promo/ { try_files $uri /promo.html; } 我在/promo调用中收到404错误(但在/promo.html上得到了正确的页面) 如何通过nginx实现?您所在的位置指定了不同的URI,而不是/promo。

我有两个html文件-
index.html
promo.html
需要在
/
上提供
index.html
,在
/promo
上提供
promo.html

尝试添加一个位置:

location /promo/ {
    try_files $uri /promo.html;
}
我在/promo调用中收到404错误(但在/promo.html上得到了正确的页面)


如何通过nginx实现?

您所在的位置指定了不同的URI,而不是
/promo