How to allow local access to a website on Nginx
You can block access to a particular site in nginx using the 'allow' keyword in site file
Open the site file and add the following under the 'location / {'
allow 192.168.1.0/24;
deny all;
Example:
location / {
allow 192.168.1.0/20;
deny all;
root /opt/alfresco-4.0.d/tomcat/webapps/share/;
proxy_pass http://localhost:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header host $host;
proxy_set_header X-Forwarded-Server $host;
}
}
This will allow the site to be accessed from 192.168.1.0 network and block all external traffic.