nginx的配置文档下载和预览

server {
listen 80;
server_name localhost;
location / {
root html;
set $flag 0;
if ( $request_filename ~* ^.*?.(txt|doc|pdf|rar|gz|zip|docx|exe|xlsx|ppt|pptx|jpg|png)){  
                   set
){                     set
flag 1;
}
if ($request_uri ~* view$){
set $flag 2;
}
if ($flag = 1){
add_header Content-Disposition: attachment;
}
index index.html index.htm;
}

你可能感兴趣的:(配置,nginx)