Based on your configuration snippet there doesn't appear to be anything wrong.

Except for the fact that "/etc/nginx/html/_upload/article/files/d7/c2.xlsx" doesn't seem to exist on system.  Which means either your document root is set wrong for your server block, or you actually don't have a file in that path that it's trying.


Thomas


On 6/18/21 10:32 AM, baalchina wrote:
Hi all,
I am using nginx as my reverse proxy, and I do not want all Excel files in my server to be accessed in the internet. So I add this in my nginx.conf:

    location ~* \.(xls|xlsx)$ {
       allow 10.0.0.0/8 <http://10.0.0.0/8>;
        deny all;
    }

while my intranet address is 10.0.0.0/8 <http://10.0.0.0/8>. I found in internet, nginx return a 403 error, that's correct.

But in my intranet, which ip in 10.0.0.0/8 <http://10.0.0.0/8>, nginx return a 404 error. I looked the error.log, it return like this:

[nginx][error] open() "/etc/nginx/html/_upload/article/files/d7/c2.xlsx" failed (2: No such file or directory), client: 10.0.0.1, server: xxxxx request: "GET /_upload/article/files/d7/c2.xlsx HTTP/1.1", host: "xxx", referrer: "xxx"

So, is there anything wrong in my config file?

Thanks.


--
from:baalchina

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to