nginx prevent file download

Francis Daly francis at
Thu Aug 30 07:45:51 UTC 2018

On Wed, Aug 29, 2018 at 09:15:26PM +0530, Kaushal Shriyan wrote:

Hi there,

> When i hit
> 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?

Francis Daly        francis at

More information about the nginx mailing list