- 浏览: 1449449 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (691)
- linux (207)
- shell (33)
- java (42)
- 其他 (22)
- javascript (33)
- cloud (16)
- python (33)
- c (48)
- sql (12)
- 工具 (6)
- 缓存 (16)
- ubuntu (7)
- perl (3)
- lua (2)
- 超级有用 (2)
- 服务器 (2)
- mac (22)
- nginx (34)
- php (2)
- 内核 (2)
- gdb (13)
- ICTCLAS (2)
- mac android (0)
- unix (1)
- android (1)
- vim (1)
- epoll (1)
- ios (21)
- mysql (3)
- systemtap (1)
- 算法 (2)
- 汇编 (2)
- arm (3)
- 我的数据结构 (8)
- websocket (12)
- hadoop (5)
- thrift (2)
- hbase (1)
- graphviz (1)
- redis (1)
- raspberry (2)
- qemu (31)
- opencv (4)
- socket (1)
- opengl (1)
- ibeacons (1)
- emacs (6)
- openstack (24)
- docker (1)
- webrtc (11)
- angularjs (2)
- neutron (23)
- jslinux (18)
- 网络 (13)
- tap (9)
- tensorflow (8)
- nlu (4)
- asm.js (5)
- sip (3)
- xl2tp (5)
- conda (1)
- emscripten (6)
- ffmpeg (10)
- srt (1)
- wasm (5)
- bert (3)
- kaldi (4)
- 知识图谱 (1)
最新评论
-
wahahachuang8:
我喜欢代码简洁易读,服务稳定的推送服务,前段时间研究了一下go ...
websocket的helloworld -
q114687576:
http://www.blue-zero.com/WebSoc ...
websocket的helloworld -
zhaoyanzimm:
感谢您的分享,给我提供了很大的帮助,在使用过程中发现了一个问题 ...
nginx的helloworld模块的helloworld -
haoningabc:
leebyte 写道太NB了,期待早日用上Killinux!么 ...
qemu+emacs+gdb调试内核 -
leebyte:
太NB了,期待早日用上Killinux!
qemu+emacs+gdb调试内核
用途,确认一个链接比如下载pdf,在一定有效期内有用
可以加个用户的权限验证,随便用个密钥和路径和时间戳,生成url串,如果不是在指定时间内访问,则可以自定义错误编码402,407等任意
1.nginx编译的时候需要./configure --prefix=/usr/local/nginx --with-http_secure_link_module
2.确定nginx要保护的目录,配置在nginx.conf中
3.用php可以生成可用链接,先用fastcgi把php跑起来
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f /usr/bin/php-cgi -P /var/run/fastcgi-php.pid
随便建立个文件pdf文件
[root@haoning html]# tree . ├── 50x.html ├── index.html ├── index.php ├── p │ └── files │ └── top_secret.pdf └── test.php 2 directories, 5 files [root@haoning html]# pwd /usr/local/nginx/html [root@haoning html]#
php代码
[root@haoning sbin]# cat ../html/test.php <?php $secret = 'segredo'; // To make the hash more difficult to reproduce. $path = '/p/files/top_secret.pdf'; // This is the file to send to the user. $expire = time()+100; // At which point in time the file should expire. time() + x; would be the usual usage. echo $expire; echo "</br>"; echo time(); echo "</br>"; $md5 = base64_encode(md5($secret . $path . $expire, true)); // Using binary hashing. $md5 = strtr($md5, '+/', '-_'); // + and / are considered special characters in URLs, see the wikipedia page linked in references. $md5 = str_replace('=', '', $md5); // When used in query parameters the base64 padding character is considered special. echo $md5; echo "</br>"; echo "http://210.56.194.39/p/files/top_secret.pdf?st=$md5&e=$expire"; echo "</br>"; echo "<a href=\"http://210.56.194.39/p/files/top_secret.pdf?st=$md5&e=$expire\">http://210.56.194.39/p/files/top_secret.pdf?st=$md5&e=$expire</a>" ?>
nginx.conf
[root@haoning conf]# cat nginx.conf worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location /p/ { secure_link $arg_st,$arg_e; secure_link_md5 segredo$uri$arg_e; if ($secure_link = "") { return 402; } if ($secure_link = "0") { return 405; } } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; set $path_info "/"; set $real_script_name $fastcgi_script_name; if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") { set $real_script_name $1; set $path_info $2; } } fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; fastcgi_param script_name $real_script_name; fastcgi_param path_info $path_info; include /usr/local/nginx/conf/fastcgi_params; } } [root@haoning conf]#
官方链接
http://wiki.nginx.org/HttpSecureLinkModule
后续还要结合
https://github.com/netdna/ngx_secure_token
发表评论
-
ios的safari使用自制ca证书测试webrtc
2018-08-20 13:31 2346这个需要注意 https://stackoverflow.c ... -
nginx push_upstream模块的websocket
2018-05-04 23:27 1160参考 https://www.rails365.net/art ... -
openresty聊天室的helloworld
2018-04-22 19:25 728openresty的websocket + redis的sub ... -
openresty websocket
2018-04-18 17:08 1423mac安装openresty brew install o ... -
nginx模块开发(三)upstream模块
2017-08-20 23:48 801使用nginx-1.13.4版本 三个文件ngx_http_ ... -
nginx模块开发(二) 使用gdb-dashboard调试
2017-08-11 18:47 1931gdb-dashboard或者 gdbgui 或者gdb自带 ... -
nginx模块开发(一)
2017-07-29 22:44 530决定重新整理nginx模块开发 helloworld con ... -
nginx带进度条的上传超大文件
2016-12-12 18:40 382811年写的 http://haoningabc.iteye.c ... -
nginx rewrite替代apache rewrite
2016-10-18 20:30 790清理chrome的缓存 chrome://appcache-i ... -
ffmpeg+nginx 的直播(2,直播摄像头和麦克风)
2016-05-28 20:21 4266假设我的服务器是centos7 192.168.139.117 ... -
ffmpeg+nginx 的直播(1,直播播放的视频文件)
2016-05-26 17:11 652964位操作系统centos7 ############ 1.一 ... -
nginx执行流程
2014-04-15 18:35 1047目标:打印nginx执行之后的流程方法 my_debug.c ... -
graphviz绘制nginx函数调用图
2014-04-14 18:43 1432以下是c的版本 c++代码去 http://www.cnblo ... -
nginx的远程调用模块
2014-03-24 14:31 2738在tx工作的时候,自己的虚拟机总是连接不上,公司封了ssh端口 ... -
通过nginx远程执行shell
2014-03-03 10:26 4998saltstack远程执行shell,远程管理等返回json已 ... -
nginx的upstream模块
2014-01-17 17:37 3165参考http://nginx.weebly.com/31034 ... -
nginx调试日志的几种方法
2013-10-17 22:54 23251最简单的方式就是 fprintf(stderr, &qu ... -
nginx 上传进度条
2012-11-01 16:24 7556费劲周折,一晚上终于搞定了,nginx版本1.38 ----- ... -
ubuntu装openrestry
2012-03-01 00:16 1290apt-get install make apt-get in ... -
udp的socket的helloworld
2011-12-07 00:56 1073来自百度 [root@red54apple test]# ...
相关推荐
nginx+lua+redis实现token验证。实现基本的token验证、反向代理转发内部服务,lua连接redis封装、lua域名解析封装、lua域名脚本等
nginx-token 是一个基于 memcached 的 Nginx 令牌模块。 示例配置: server { listen 80; root /var/www; location / { token on; token_server 127.0.0.1:11211; token_len 12; token_key token...
C#WEB用户令牌TOKEN验证,防止HTTP、GET、POST等提交包含服务端和客户端源码。Nginx集群,SSL证书的WebApi令牌验证
nginx带nginx-http-flv模块,包含所有rtmp功能,我自己在windows下编译的,直接可用,用的是最新版的1.19.4版本
网上查找nginx-openresty添加rtmp模块的方法基本都是在Linux上的。但由于项目需要在Windows上使用nginx,无奈只好自己去找资料,在Windows上编译nginx-openresty同时加入rtmp模块。本资源是Windows上生成好的...
win7+VS2015编译好的带nginx-rtmp-module模块的Nginx 64位
主要就是nginx的memcache和echo模块。另外假如需要安装memcached服务的话,里面还有安装包,方便进行测试。
双击nginx.exe # 简要说明 conf/nginx.conf 为配置文件实例 RTMP监听 1935 端口,启用live 和hls 两个application HTTP监听 8080 端口, * :8080/stat 查看stream状态 * :8080/index.html 为一个直播播放与直播...
深入理解Nginx模块开发及架构解析,深入理解Nginx模块开发及架构解析
nginx安装和整合rtmp模块
用于 nginx 的 LDAP 身份验证模块nginx的LDAP模块,支持针对多个LDAP服务器的身份验证。如何安装FreeBSD cd /usr/ports/www/nginx && make config install clean 检查 HTTP_AUTH_LDAP 选项 [*] ...
主要介绍了SpringBoot集成FastDFS+Nginx整合基于Token的防盗链的方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
nginx的内部结构是由核心部分和一系列的功能模块所组成。这样划分是为了使得每个模块的功能相对简单,便于开发,同时也便于对系统进行功能扩展。这样的模块化设计类似于面向对象中的接口类,它增强了nginx源码的...
nginx的mod_wsgi模块, 适用于nginx 0.5.34, 其他版本有对应的patch(尚不支持0.7.x, 对于0.6.x版本打过附带的patch之后编译可能还会有问题). 建议: python编译的时候推荐使用--eneble-shared, 否则需要修改mod_wsgi...
生产版nginx最新版本Dockerfile 添加主动检查nginx_upstream_check_module等第三方模块,
nginx-upload-module模块源码,用于nginx配置文件上传功能
ngx_sqlite 是嵌入 sqlite 数据库的 nginx 模块。通过强大的nginx server,可以使用http协议访问sqlite数据库。环境- sqlite 3- nginx-1.6.3 安装```sh $ git clone https://github.com/rryqszq4/ngx_sqlite.git...
nginx-upload-progress模块源码,用于nginx配置获取文件上传进度。
NULL 博文链接:https://openplatform-sohu-com.iteye.com/blog/628375
nginx无证书情况用stream模块反向代理https网站 windows编译版 如何使用请参考https://blog.csdn.net/gggauss/article/details/89140446