Check the legality of the request for resources
server {
listen 3300;
server_name www.siguoya.name;
root /usr/local/nginx/1.12.1/html;
location / {
secure_link $arg_md5,$arg_expires;
secure_link_md5 "$secure_link_expires$uri siguoya";
if ($secure_link = "") {
return 403;
}
if ($secure_link = "0") {
return 410;
}
}
}
If you are accessing http://www.siguoya.name:3300/index.html?expires=111
it, shell md5 values calculated as follows:
echo -n '111/index.html siguoya' | openssl md5 -binary | openssl base64 | tr +/ -_ | tr -d =
link | Response Code |
---|---|
http://www.siguoya.name:3300/index.html?expires=111&md5=111 |
403, md5 incorrect time expired |
http://www.siguoya.name:3300/index.html?expires=2147483647&md5=111 |
403, md5 is not correct, time has not expired |
http://www.siguoya.name:3300/index.html?expires=111&md5=cLdY2ROg2kZDD0xkWaJ8TQ |
410, md5 correct time expired |
http://www.siguoya.name:3300/index.html?expires=2147483647&md5=GfmT6Hj3U55xfQJ3aNqjfQ |
200, md5 correct, time has not expired |
Read topics
- 1. Nginx advantage
- 2. Nginx installation and boot from Kai
- 3. Nginx configuration syntax and directories
- 4. Nginx module
- 5. Nginx handling the static resources
- 6. Nginx browser cache principle
- 7. Cross-domain access resources Nginx
- Anti-theft chain 8. Nginx resources
- 9. Nginx proxy
- 10. Nginx Load Balancing
- 11. Nginx cache
- 12. Nginx static and dynamic separation
- 13. Nginx Rewrite
- 14. Nginx Secure Link
- 15. Nginx Geo
- 16. Nginx HTTPS service
- 17. Nginx and development of Lua
- 18. Nginx release and gray Lua
- 19. Nginx common errors
- 20. Nginx performance optimization
- 21. Nginx Security Management