On Thu, 2010-08-12 at 13:44 -0700, antituhan wrote:
Hi, Could nginx restrict direct link access / hotlink access to
specified file/extension ?
I try to write the rules like this :
location ~ ^/*(.exe)$ {
deny ip.ad.dr.es;
}
On Mon, 2010-08-16 at 10:27 -0700, antituhan wrote:
Thanks, but this rules will show 404 not found on my site
Unlisted IP (allowed IP) will be redirected to 404 not found page.
You need to have a root directive. Either put one in the server section
(generally preferred) or if your .exe’s are in a particular place, you
can put it in the location directive.
If that doesn’t fix it then you will need to post your config so someone
can help you debug it.
You should look into x-file-redirect. That way you can have a backend
script handle the authentication and then let Nginx handle the streaming
part if the user is allowed to download .
If I put the deny rules on a root directive, the rule will blocked all
access. But I just want to block the specified extension. I’ve tried
many
regular expression, but I can’t find the right one
On Tue, Aug 17, 2010 at 05:38:55PM -0700, antituhan wrote:
If I put the deny rules on a root directive, the rule will blocked all
access. But I just want to block the specified extension. I’ve tried many
regular expression, but I can’t find the right one
This is the error_log from my nginx :
2010/08/19 10:15:24 [error] 10941#0: *56 open()
“/usr/share/nginx/html/e107_files/downloads/OS/89xx/OFFICIAL_8900M_PBr5.0.0_rel1004_PL5.2.0.58_A5.0.0.592_Wind_Hellas.exe”
failed (2: No such file or directory), client: ip.ad.dr.es, server: antituhan.com, request: “GET
/e107_files/downloads/OS/89xx/OFFICIAL_8900M_PBr5.0.0_rel1004_PL5.2.0.58_A5.0.0.592_Wind_Hellas.exe
HTTP/1.1”, host: “antituhan.com”
I know why nginx shows 404’s error code, the root path is changed from