Welcome! Log In Create A New Profile

Advanced

nginx prevent file download

Posted by Kaushal Shriyan 
Kaushal Shriyan
nginx prevent file download
August 29, 2018 05:50PM
Hi,

I am running nginx webserver and i have set the below location block in
nginx.conf configuration file to prevent a file to download. When i hit
http://example.com/web.config on the browser, the web.config file gets
downloaded. It is not working.

location ~* \.(config)$ {
deny all;
}


I will appreciate if somebody can pitch in for help. Thanks in Advance.

Best Regards,

Kaushal
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Francis Daly
Re: nginx prevent file download
August 30, 2018 09:50AM
On Wed, Aug 29, 2018 at 09:15:26PM +0530, Kaushal Shriyan wrote:

Hi there,

> When i hit
> http://example.com/web.config on the browser, the web.config file gets
> downloaded. It is not working.
>
> location ~* \.(config)$ {
> deny all;
> }

It works for me.

Are you sure that the config file that you think you are using is actually
being used?

Do you have any other "location" blocks defined that nginx will choose
to process the "/web.config" request, instead of this one?

If you test by temporarily making this the only location{} block in your
config, do you see it work or fail?

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login