Welcome! Log In Create A New Profile

Advanced

Block file access in specific directory

Posted by Sitruc 
Block file access in specific directory
June 19, 2014 10:47AM
I need to block access to log files that are stored in a publicly accessible directory from being viewed publicly. These are stored as CGI files and as things are right now, anyone can view the directory directly and download the .CGI file which is a huge security concern as it showcases IP address of visitors and other things.


How can I block access to "/path/to/the/directory/*.cgi" ?

I tried:

location /path/to/the/directory/*.cgi {
deny all;
}

But it did not work.
Re: Block file access in specific directory
June 23, 2014 06:08PM
Anyone?..
Re: Block file access in specific directory
June 24, 2014 02:11AM
Sitruc Wrote:
-------------------------------------------------------
> I need to block access to log files that are stored in a publicly
> accessible directory from being viewed publicly. These are stored as
> CGI files and as things are right now, anyone can view the directory
> directly and download the .CGI file which is a huge security concern
> as it showcases IP address of visitors and other things.
>
>
> How can I block access to "/path/to/the/directory/*.cgi" ?
>
> I tried:
>
> location /path/to/the/directory/*.cgi {
> deny all;
> }
>
> But it did not work.

What about:

location ~ /path/to/the/directory/*\.cgi$ {
deny all;
}

---
nginx for Windows http://nginx-win.ecsds.eu/
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 155
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