How can I protect files on my NGiNX server?

Posted by Jean-Nicolas Boulay Desjardins on Server Fault See other posts from Server Fault or by Jean-Nicolas Boulay Desjardins
Published on 2011-11-19T03:19:16Z Indexed on 2011/11/19 9:55 UTC
Read the original article Hit count: 212

Filed under:
|
|

I am trying to protect files on my server (multiple types), with NGiNX and PHP.

Basically I want people to have to sign in to the website if they want to access those static files like images. DropBox does it very well. Where by they force you to sign in to access any static files you put on there server.

I though about using NGiNX Perl Module. And I would write a perl script that would check the session to see if the user was sign in to give them access to a static file.

I would prefer using PHP because all my code is running under PHP and I am not sure how to check a session created by PHP with PERL.

So basically my question is: How can I protect static files of any types that would need the user to have sign in and have a valid session created with a PHP script?

© Server Fault or respective owner

Related posts about security

Related posts about nginx