location /download {
        root /root/download/;
        if ($request_filename ~* ^.*?\.(txt|doc|pdf|rar|gz|zip|docx|exe|xlsx|ppt|pptx)$){
            add_header Content-Disposition: 'attachment;';
        }
        autoindex     on;
        autoindex_exact_size   on;
        autoindex_localtime    on;
        #allow   192.168.4.0/24;         #允许4段的所有地址访问
        #allow   192.168.5.0/24;         #允许5段的所有地址访问
        #deny    all;                     #禁止全部

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code