block all ip except one in nginix


New Member
I want to block all visitors except one ip on my new site that I am working on it
in apache htaccess it was easy but now I have a sever nginx

I don't know how to do it .
It's pretty easy in Nginx.

allow; # Allow a single remote host
deny all; # Deny everyone else
Thanks Jonathan . You are still with known host :) Yes I know that code but I am not sure where to put it. My server is
Nginx & Varnish & Apache
HTTP: Nginx (80) --> Varnish (82) --> Apache (8181)
HTTPS: Nginx (443) --> Varnish (82) --> Apache (8181)