<html><head></head><body>I think the problem is the order of your deny and allow statements. Nginx processes them in turn. So nginx reads the allow one okay, but then reads the subsequent one as "deny all (including 10....)". Hence xls are denied to all.<br><br>If you swap the order then it should work as intended (assuming the files exist and are in the right doc root, etc).<br><br><br><br><div class="gmail_quote">On 18 June 2021 15:32:51 BST, baalchina <baalchina@gmail.com> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div dir="ltr">Hi all, <div>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:</div><div><br></div><div>    location ~* \.(xls|xlsx)$ {<br>       allow <a href="http://10.0.0.0/8">10.0.0.0/8</a>;<br>        deny all;<br>    }<br></div><div><br></div><div>while my intranet address is <a href="http://10.0.0.0/8">10.0.0.0/8</a>. I found in internet, nginx return a 403 error, that's correct.</div><div><br></div><div>But in my intranet, which ip in <a href="http://10.0.0.0/8">10.0.0.0/8</a>, nginx return a 404 error. I looked the error.log, it return like this:</div><div><br></div><div>[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"<br></div><div><br></div><div>So, is there anything wrong in my config file?</div><div><br></div><div>Thanks.</div><div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">from:baalchina</div></div></div>
</blockquote></div></body></html>