本帖最后由 1499989946rgpo 于 2017-9-25 22:27 编辑
找到段不完整代码,用于多服务器下载防盗链,nginx配置如下,求html或php 代码
出处:http://www.92csz.com/36/1120.html 不能留言,看不到隐藏。不知 bt这边有没有高人帮忙解下,感激不尽。
前端下载页面nginx代码
- server
- {
- listen 80;
- server_name download.xxx.com;
- index index.htm index.html;
- root /www/wwwroot/download;
- ssi on;
-
- location /
- {
- set_by_lua $downkey '
- return ngx.md5("encryption" .. ngx.var.remote_addr .. "suffix")
- ';
- }
- }
复制代码
后端下载服务器nginx代码
- server
- {
- listen 80;
- server_name down.xxx.com;
- index index.htm index.html;
- root <font style="font-size: 16px"> /www/wwwroot/data</font>;
- limit_conn one 1;
- set $limit_rate 1000k;
-
- location /
- {
- set_by_lua $foo '
- if string.sub(ngx.var.uri, 2, 33) == ngx.md5("encryption" .. ngx.var.remote_addr .. "suffix") then
- return 1
- else
- return 0
- end
- ';
-
- if ($foo = 1)
- {
- rewrite "^/([0-9a-z]{32})(.*?)[ DISCUZ_CODE_1 ]quot; $2 break;
- }
- if ($foo = 0)
- {
- rewrite ^/ <a href="http://download.xxx.com/404.htm" target="_blank">http://download.xxx.com/404.htm</a> redirect;
- }
- }
- }
复制代码
|
|