block all ip except one in nginix

knowhostfan

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 .
 

KH-Jonathan

Director of Managed Services
Staff member
It's pretty easy in Nginx.

Code:
allow 1.2.3.4; # Allow a single remote host
deny all; # Deny everyone else
 

knowhostfan

New Member
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)
 
Top