December 2017
Intermediate to advanced
316 pages
6h 58m
English
This is the most important piece in the Nginx set up. In this section, we will see how to restrict access to our server using basic authentication. This will be very important for our REST API servers because, let us suppose we have servers X, Y, and Z that talk to each other. X can serve clients directly, but X talks to Y and Z for some information by calling an internal API. Since we know that clients should not access Y or Z, we can make it so that only X is allowed to access the resources. We can allow or deny the IP addresses using the nginx access module. It looks like this:
location /api { ... deny 192.168.1.2; allow 192.168.1.1/24; allow 127.0.0.1; deny all;}
This configuration tells Nginx to allow ...
Read now
Unlock full access