Nginx ngx_http_random_index_module模块基本指令整理

原创文章,转载请指明出处并保留原文url地址

本文主要针对nginx的ngx_http_random_index_module模块做简单介绍,本文具体包括如下指令:random_index

该ngx_http_random_index_module模块处理以斜杠字符(“/”)为结束的请求, 它在一个目录中随机选择一个文件作为一个索引文件。在ngx_http_index_module模块。这个模块优先生效于ngx_http_index_module模块

这个模块不是内建模块,需要使用--with-http_random_index_module指令来使能这个功能。

配置示例如下:

location / {

random_index on;

}

Nginx原文:

The ngx_http_random_index_module module processes requests ending with the slash character (‘/’) and picks a random file in a directory as an index file. It works before the ngx_http_index_module module.

This module is not built by default, it should be enabled with the --with-http_random_index_module configuration parameter.

Example Configuration

location / {

random_index on;

}

1. random_index

syntax:random_index   on | off;
default:random_index off;
context:location

在配置这个指令的location中启用或禁用本模块。

Nginx原文:

Enables or disables module processing in a surrounding location.

发表评论