首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 开源软件 >

nginx HttpSecureLinkModule 逾期token验证模块

2012-11-15 
nginx HttpSecureLinkModule 过期token验证模块用途,确认一个链接比如下载pdf,在一定有效期内有用可以加个

nginx HttpSecureLinkModule 过期token验证模块

用途,确认一个链接比如下载pdf,在一定有效期内有用
可以加个用户的权限验证,随便用个密钥和路径和时间戳,生成url串,如果不是在指定时间内访问,则可以自定义错误编码402,407等任意
1.nginx编译的时候需要./configure --prefix=/usr/local/nginx --with-http_secure_link_module
2.确定nginx要保护的目录,配置在nginx.conf中
3.用php可以生成可用链接,先用fastcgi把php跑起来

[root@haoning conf]# cat nginx.confworker_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

热点排行