一、查看内置了哪些模块
nginx -V

不仅仅是我圈中的那些,--with moudle的都是。
二、--with-http_stub_status_moudle
1、作用
Nginx的客户端状态
2、配置语法
location /mystatus {
stub_status;
}

三、--with-http_random_index_moudle
1、作用
目录中选择一个随机主页。
2、配置语法
location / {
root /chentongwei/app/code/;
random_index on;
}

然后请求我们的nginx,会发现每次的输出结果不同。是随机的(1.html/2.html/3.html)。
默认是off关闭的。
四、--with-http_sub_moudle
1、作用
http内容替换。
2、配置语法
location / {
root /chentongwei/app/code;
index index.html index.htm;
sub_filter 'ctw' '<h1>chentongwei</h1>';
}
PS:
意思是将/chentongwei/app/code
目录下的文件里的ctw字符串替换成<h1>chentongwei</h1>
我们有如下submoudle.html
[chentongwei@YY155 app]$ cat code/submoudle.html
a
b
c
d
ctw
e
f
g
ctw
结果:

只替换了第一个匹配到的,并没有全部匹配。若需要全部匹配,则关闭如下选项即可:
sub_filter_once off;
默认是on。
关闭sub_filter_once
后的配置
location / {
root /chentongwei/app/code;
index index.html index.htm;
sub_filter 'ctw' '<h1>chentongwei</h1>';
sub_filter_once off;
}
结果:

五、广告
-
码云点star,万分感谢!
代码已经上传到码云了
https://gitee.com/geekerdream/spring-anonation
通用的权限处理框架
https://gitee.com/geekerdream/common-security
通用的异常处理
https://gitee.com/geekerdream/exception-handler
通用的发送邮件
https://gitee.com/geekerdream/common-boot-email
陆续会推出更多干货,希望关注!
-
QQ群【Java初学者学习交流群】:458430385
-
微信公众号【Java码农社区】
- 今日头条号:编程界的小学生
网友评论