• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

0x1cc4

Youth means limitless possibilities. 年轻就是无限的可能。
  • 订阅
  • 管理

公告

View Post

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

posted on 2024-07-11 17:16  0x1cc4  阅读(14)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3