Nginx Directory Listing - Restrict by IP Address

Sathish Kumar satcse88 at
Fri May 18 00:05:34 UTC 2018

Hi Team,

We have a requirement to allow directory listing from few servers and
disallow from other ip addresses and all IP addresses should be able to
download all files inside the directory.

Can somebody provide the correct nginx config for the same.

location / {
root /downloads;
autoindex on;
deny all;

If I use the above config, only on IP address can directory list
from this server and can file download but from other IP addresses download
shows forbidden, due to IP address restriction

Is there a way to overcome this issue, thanks.

Thanks & Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list