Mastering Nginx

(Ron) #1
Chapter 6

[ 137 ]

satisfy any;

}

If, instead, the requirements are for a configuration in which the user must come
from a certain IP address and provide authentication, the all parameter is the


default. So, we omit the satisfy directive itself and include only allow, deny,


auth_basic, and auth_basic_user_file:


server {

server_name stage.example.com;

location / {

auth_basic "staging server";

auth_basic_user_file conf/htpasswd-stage;

allow 192.168.40.0/24;

allow 192.168.50.0/24;

deny all;

}

Streaming media files


NGINX is capable of serving certain video media types. The flv and mp4 modules,


included in the base distribution, can perform what is called pseudo-streaming. This
means that NGINX will seek to a certain location in the video file, as indicated by the


start request parameter.


In order to use the pseudo-streaming capabilities, the corresponding module needs


to be included at compile time: --with-http_flv_module for Flash Video (FLV) files
and/or --with-http_mp4_module for H.264/AAC files. The following directives


will then become available for configuration:


Table: HTTP streaming directives

Directive Explanation
flv Activates the flv module for this location.
mp4 Activates the mp4 module for this location.
Free download pdf