How to enable directory browsing only for 1 ip?

Hello guys ,
I’m using virtualmin with nginx plugin . I want to know if there is a way to just allow " autoindex on; " for 1 specific ip and the rest can’t browse the directories? What nginx rules can do that?
Regards ,

Any helps would be appreciated

Hi,

Hey already tried that and failed . can you be specific about the parameters as well? Imagine I want to allow autoindex only for IP : 144.144.88.88 and I want this rule to be applied to / ( all files under / )
Should the config look like this?

geo $geoAutoIndexWhitelist {
    default             0;
    144.144.88.88          1;
}

server {
    ...
    root /;
    autoindex off;

    location / {
        if ($geoAutoIndexWhitelist) {
        rewrite ^/(.*)$ /$1 last;
        }
        try_files $uri $uri.html $uri/ =404;
    }

    location / {
        internal;
        alias /;
        autoindex on;
    }
}

Have you tried something else for root directive, like /usr/share/nginx/html?