配置如下
location ~* ^/a(.*)/(.*)$ {
set $c $1;
set $d $2;
alias /var/www/xx.xxx.xxx/a$c/$d;
fancyindex on;
fancyindex_exact_size off;
fancyindex_localtime on;
if ( $d ~* .*\.(txt|log|js|css)$) {
more_clear_headers "content-type";
add_header Content-Type text/plain;
}
}
现在的问题是访问 xx.xxx.xxx/axx/ 下面任何带有中文或者空格的资源(非 txt,log,js,css 结尾的)的时候都会 404,日志我也看了,编码没有问题。只要把 if 语句去掉就 OK。是在找不到原因了。 大佬求助