nginx-lua-ds-hotlink 介绍
基于Nginx和lua的防盗链系统
A Prevent Hotlinking System based on Nginx and lua
将代码放在位于Nginx根目录下的lua/ds_hotlink/下
Put the code into the directory lua/ds_hotlink which is located in the root
directory of the Nginx
Add the config below to the http seg in Nginx.conf:
lua_package_path "/u/Nginx/lua/ds_hotlink/?.lua;;"; init_by_lua_file lua/ds_hotlink/init.lua;
配置如下location用于获取访问key
Add the config below to /get_key location for geting access key
location = /get_key { allow 10.0.2.2; deny all; content_by_lua_file lua/ds_hotlink/get_key.lua; }
在需要防盗链的location下配置如下
Add the config below to a location which need to prevent hotlinking
access_by_lua_file lua/ds_hotlink/refer.lua;
或者配置如下
Alternative config below
access_by_lua_file lua/ds_hotlink/accesskey.lua;
防盗链相关的配置在config.lua中,需要保证Nginx的worker process对日志文件有读写权限
You can config Prevent Hotlinking System with the file config.lua,and you must
make the worker process of Nginx have the read and write permission to the log
file
nginx-lua-ds-hotlink 官网
https://github.com/Hevienz/nginx-lua-ds-hotlink
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。