sometimes, we need an authenticated link to provent our resources form abusing.
now we will accomplish that by using nginx-module-njs. here we go.
install nginx and nginx-module-njs module
1 | wget http://nginx.org/keys/nginx_signing.key -O nginx_signing.key |
authentication.js
1 | var cr = require('crypto') |
nginx.conf
1 | user www-data; |
link generator(Python)
1 | import click |
link generator usage
1 | python gen_link.py -f path/to/file.txt -e 3h #the generated link will be expires in 3 hours |