nginx 记录
文件下载服务
location /xxx {
alias /usr/share/nginx/html/app-h5/file;
if ($request_filename ~* ^.*?\.(html|doc|pdf|zip|docx|txt|ipa|plist|apk)$) {
add_header Content-Disposition attachment;
add_header Content-Type application/octet-stream;
}
# 开启高效文件传输模式
sendfile on;
# 开启目录文件列表
autoindex on;
# 显示出文件的确切大小,单位是bytes
autoindex_exact_size on;
# 显示的文件时间为文件的服务器时间
autoindex_localtime on;
# 避免中文乱码
charset utf-8,gbk;
}
#SECURITY-START 防盗链配置
location ~ .*\.(jpg|jpeg|gif|png|js|css)$
{
expires 30d;
access_log /dev/null;
valid_referers www.xxxx.com xxx.com;
if ($invalid_referer){
return 404;
}
}
本文来自博客园,作者:0x1cc4,转载请注明原文链接:https://www.cnblogs.com/0x1cc4/p/18296719
浙公网安备 33010602011771号