配置需求
注:$document_uri 表示訪問的url
需求:訪問 www.abc.com 請求到 www.abc.com/abc/
使用操作
1、在nginx配置文件中加入

if ($document_uri !~ 'abc') { rewrite ^/(.*)$ http://www.abc.com/abc/$1 permanent; }

而不是單獨加一句 rewrite ^/(.*)$ http://www.abc.com/abc/$1 permanent;
如果只加rewrite 規則,而不限定條件,那么會造成死循環。 會訪問到 http://www.abc.com/abc/abc/abc/abc/....