[root@hk sbin]#./nginx -V
nginx version: nginx/1.14.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/data/nginx --with-http_ssl_module --with-http_secure_link_module #要编译安装with-http_secure_link_module模块
server {
listen 80;
server_name secure.aaa.com;
location /p {
secure_link_secret mysecret; #设置一个秘钥为mysecret
if ($secure_link = "") { #$secure_link为md5值
return 403;
}
rewrite ^ /secure/$secure_link; #当访问p路径时重定向到/secure/$secure_link #$secure_link为md5值,是访问的uri和mysecret的md5值
}
location /secure {
alias html; #此目录下有index.html
internal;
}
}
echo -n "index.htmlmysecret" |md5sum 求出md5值为42166c69bd0439cfa8d338a9f671d83e
http://secure.zhangdazhi.com/p/42166c69bd0439cfa8d338a9f671d83e/index.html #浏览器访问此url才能访问
网友评论