# Download Queue

**URL:** <https://www.ruby-forum.com/t/download-queue/180409>\
**Category:** NGINX\
**Created:** [December 19, 2009, 3:25pm UTC](https://www.ruby-forum.com/t/download-queue/180409 "2009-12-19T15:25:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kiswono\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/4af34b/32.png) [@Kiswono\_P](https://www.ruby-forum.com/u/Kiswono_P)\
**Post date:** [December 19, 2009, 3:25pm UTC](https://www.ruby-forum.com/t/download-queue/180409/1 "2009-12-19T15:25:28Z")

</div>

hi, i trying to make to make downloader site, the process was like this:

1. user enter the site
2. paste their link
3. and the wget or downloader program would download the files every  
night
4. the file saved using the primary key of the database value (number),  
this one example of the table row:  
reqid: 273  
userid: 5  
reqlink: [http://127.0.0.1/bla.pdf](http://127.0.0.1/bla.pdf)  
reqtime: 2009-12-03 07:22:01

the file saved on /data/dl/273.data  
how can i protect the download link so people wont able to download  
directly  
but must use some link, such as:  
[http://bla/get/273](http://bla/get/273) but this link only activated when people has logged  
in…

what i mean is, can i make temporary link that can only be accessed  
certain  
IP and session (of the logged user), one request only, without messing  
around and reload nginx’s configuration everytime authenticated people  
wan’t  
to download the file, and without load file into server side scripting  
engine (PHP, etc) because it’s slow when i use server side engine to  
serve  
the file…

Thanks for care to read this mail…

Regards,  
Kiswono  
GB

---

<div class="post-metadata">

**Author:** ![Kiswono\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/4af34b/32.png) [@Kiswono\_P](https://www.ruby-forum.com/u/Kiswono_P)\
**Post date:** [December 19, 2009, 3:25pm UTC](https://www.ruby-forum.com/t/download-queue/180409/2 "2009-12-19T15:25:28Z")

</div>

Maybe this will be of help?

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

Kiswono P. wrote:

> into server side scripting engine (PHP, etc) because it’s slow when i
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)

–

_Phillip B Oldham_  
ActivityHQ  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) [mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

* * *

_Policies_

This e-mail and its attachments are intended for the above named  
recipient(s) only and may be confidential. If they have come to you in  
error, please reply to this e-mail and highlight the error. No action  
should be taken regarding content, nor must you copy or show them to  
anyone.

This e-mail has been created in the knowledge that Internet e-mail is  
not a 100% secure communications medium, and we have taken steps to  
ensure that this e-mail and attachments are free from any virus. We must  
advise that in keeping with good computing practice the recipient should  
ensure they are completely virus free, and that you understand and  
observe the lack of security when e-mailing us.

---

<div class="post-metadata">

**Author:** ![Kiswono\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/4af34b/32.png) [@Kiswono\_P](https://www.ruby-forum.com/u/Kiswono_P)\
**Post date:** [December 19, 2009, 3:25pm UTC](https://www.ruby-forum.com/t/download-queue/180409/3 "2009-12-19T15:25:28Z")

</div>

On Thu, Dec 3, 2009 at 4:34 PM, Phillip O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Maybe this will be of help?
> 
> [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/NginxHttpAccessKeyModule)

thanks, but using that lib, i still should mess with nginx main  
configuration or at least “sites-available/somesite” file ^^ hmm.. this  
case  
hard to crack.. i wonder how rapidshare or megaupload did their things..  
did  
they serve their file using server side script, wouln’t it be slow and  
wasting resource..

---

<div class="post-metadata">

**Author:** ![Kiswono\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/4af34b/32.png) [@Kiswono\_P](https://www.ruby-forum.com/u/Kiswono_P)\
**Post date:** [December 19, 2009, 3:25pm UTC](https://www.ruby-forum.com/t/download-queue/180409/4 "2009-12-19T15:25:28Z")

</div>

X-Accel-Redirectthe is the key, i also use this feature, works like a  
charm.

The server side script only send the header fast, secure and easy to  
setup…

---

<div class="post-metadata">

**Author:** ![Kiswono\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/4af34b/32.png) [@Kiswono\_P](https://www.ruby-forum.com/u/Kiswono_P)\
**Post date:** [December 19, 2009, 3:25pm UTC](https://www.ruby-forum.com/t/download-queue/180409/5 "2009-12-19T15:25:28Z")

</div>

On Thu, Dec 3, 2009 at 18:38, Kiswono P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> thanks, but using that lib, iÂ Â stillÂ should mess with nginx main  
> configuration or at least “sites-available/somesite” file ^^ hmm.. this case  
> hard to crack.. i wonder how rapidshare or megaupload did their things.. did  
> they serve their file using server side script, wouln’t it be slow and  
> wasting resource..

You could try X-Accel-Redirect header,

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

So your script just have to emit the header. File delivery will be  
handled by nginx.

–  
Arie Karhendana

---

<div class="post-metadata">

**Author:** ![Kiswono\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/4af34b/32.png) [@Kiswono\_P](https://www.ruby-forum.com/u/Kiswono_P)\
**Post date:** [December 19, 2009, 3:25pm UTC](https://www.ruby-forum.com/t/download-queue/180409/6 "2009-12-19T15:25:28Z")

</div>

oic thank you all, i will try to learn it, if i got it wrong, i will ask  
again ^^

btw mr. arie, you’re from indonesia right ^^ nice to meet you..

Arie Karhendana wrote:

> >

On Thu, Dec 3, 2009 at 6:57 PM, Alexander K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> X-Accel-Redirectthe is the key, i also use this feature, works like a  
> charm.
> 
> The server side script only send the header fast, secure and easy to  
> setup…
> 
> –  
> Regards,  
> Kiswono P  
> GB
