前言
一般情况下,一个站点默认首页都是定义好的index.html、index.shtml、index.php等等,如果想站点下有很多页面想随机展示给用户浏览,那得程序上实现,显得尤为麻烦,如果你安装了nginx,那么使用nginx的random index即可达成这个功能,凡是以/结尾的请求,都会随机展示当前目录下的文件作为首页.
random index介绍
ngx_http_random_index_module模块处理以'/'为后缀的请求,并且在当前目录下随机抽取一个页面作为首页.这个模块将在ngx_http_index_module模块之前执行. 默认情况下,这个模块没有安装,你需要在安装nginx的时候加上配置参数--with-http_random_index_module.文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-modules-random-index/
随机首页配置
location / { random_index on; }
random index指令
语法: random_index on | off;
默认值: random_index off;
配置段: location
启用或者禁用random index模块文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-modules-random-index/
转摘请注明出处:https://www.ttlsa.com/html/2956.html文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-modules-random-index/
文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-modules-random-index/文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-modules-random-index/
我的微信
微信公众号
扫一扫关注运维生存时间公众号,获取最新技术文章~
1F
[…] 30.?nginx+fancy实现漂亮的索引目录 31.?nginx secure_link下载防盗链 32.?nginx显示随机首页模块(Random Index) 33.?nginx实现图片防盗链(referer指令) 34.?nginx空白图片(empty_gif模块) […]
来自外部的引用