设置nginx通过url访问文件只浏览不下载或者只下载不浏览

    技术2022-07-29  103

    只浏览不下载

    location / { root /home/wwwroot/; index index.html; #新增配置 add_header Content-Type text/plain; }

    只下载不浏览

    if ($request_filename ~* ^.*?\.(filename)$){ add_header Content-Disposition attachment; }
    Processed: 0.009, SQL: 9