nginx模块之random_index
2018-11-20 本文已影响7人
谜00016
官网地址。
这个模块的功能比较简单就是随机选择一个文件作为主页。默认是关闭的。
我们来演示一下。
首先修改配置文件,注意是在location节点下,

,很显然我在/opt/app/code1下准备了三个html文件。准备工作做好之后,还是老三样儿,检查-关闭nginx-启动nginx
nginx -t -c /etc/nginx/nginx.conf
nginx -s stop -c /etc/nginx/nginx.conf
nginx -c /etc/nginx/nginx.conf
在浏览器中访问192.168.205.103,多刷新几次,可以看到nginx随机选了不同的文件作为主页。