O'Reilly logo

Nginx Essentials by Valery Kholodkov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Access control

Access control restrictions are essential to day-to-day operation. Nginx includes a group of modules that let you allow or deny access depending on various conditions. Nginx denies access to a resource by returning a 403 (Forbidden HTTP) status or 401 (Unauthorized) if accessing the resource requires authentication. This 403 (Forbidden) status code can be intercepted and customized using the error_page directive.

Restricting access by IP address

Nginx allows you to permit or deny access to a virtual host or a location by IP address. For that, you can use the directives allow and deny. They have the following format:

allow <IP address> | <IP address>/<prefix size> | all;
deny <IP address> | <IP address>/<prefix size> | all;

Specifying ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required