在nginx中使用别名服务静态文件

我已经在nginx中指定了以下位置:

location ~ ^/blah/(.*)$ { alias /html/$1; autoindex on; allow all; } 

html目录具有以下结构:

 /html/ - other/ - test2.htm - test.htm 

我可以浏览到http://server/blah并获取文件列表。

我可以服务http://server/blah/other/test2.htm

当我尝试访问http://server/blah/test.htm我得到一个301,并redirect到http://server/blah/test.htm/ ,然后是404。

我怎样才能在http://server/blah/test.htm

可能redirect发生在configuration的其他地方,添加break应该有助于得到你所需要的:

 location ~ ^/blah/(.*)$ { alias /full/path/to_your/html/dir/$1; autoindex on; fancyindex on; allow all; break; }