Welcome! Log In Create A New Profile

Advanced

Re: unable to forbidden access by ip

Nick Rickard
June 20, 2021 11:22AM
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.

If you swap the order then it should work as intended (assuming the files exist and are in the right doc root, etc).



On 18 June 2021 15:32:51 BST, baalchina <baalchina@gmail.com> 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;
> deny all;
> }
>
>while my intranet address is 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, 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
Subject Author Posted

unable to forbidden access by ip

baalchina June 18, 2021 10:34AM

Re: unable to forbidden access by ip

Thomas Ward June 18, 2021 10:54AM

Re: unable to forbidden access by ip

Nick Rickard June 20, 2021 11:22AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 288
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready