第一种,当访问 /about 时,他会去找文件 `htmlindex.html` 而不是预期的 `html/index.html`。 (很多文章都说要加上尾斜杠,实际也确实如此,但是 nginx 的官方手册中似乎没有提及。不过给出的示例里面都是有的) 第三种,按照手册上的说法,你应该使用捕获组。 > If alias is used inside a location defined with a regular expression then > such regular expression should contain captures and alias should refer to > these captures (0.7.40), for example: > >> location ~ ^/users/(.+.(?:gif|jpe?g|png))$ { > alias /data/w3/images/$1; > } * [Module ngx_http_core_module](https://link.segmentfault.com/?enc=dy6my4JwLll9s3GWDbUvBA%3D%3D.HmaSd6lXg9wiCjBPD3lvTe2rAxe7qAdUq4umQz4AJ4UArvl0dSEdGiXUzuR83zwn7UvhyjondUlrI2kpo2e35w%3D%3D)