网站首页 > 技术教程 正文
一、查看内置了哪些模块
nginx -V
image.png
不仅仅是我圈中的那些,--with moudle的都是。二、--with-http_stub_status_moudle
1、作用
Nginx的客户端状态
2、配置语法
location /mystatus { stub_status; }
image.png
三、--with-http_random_index_moudle
1、作用
目录中选择一个随机主页。
2、配置语法
location / { root /chentongwei/app/code/; random_index on; }
image.png
然后请求我们的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
结果:
image.png
只替换了第一个匹配到的,并没有全部匹配。若需要全部匹配,则关闭如下选项即可:
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; }
结果:
作者:编程界的小学生
链接:https://www.jianshu.com/p/373fd752076e
猜你喜欢
- 2024-10-14 Nginx学习笔记(12) autoindex(nginx use)
- 2024-10-03 06《Nginx 入门教程》Nginx 配置初步(下)
- 2024-10-03 5、Nginx虚拟主机配置(nginx配置虚拟目录)
- 2024-10-03 如何快速部署一个带用户名和密码认证的文件分享网页服务器
- 2024-10-03 Nginx之5金钟罩 - (SSL)(金钟罩平台)
- 2024-10-03 五个案例“熄灭”Nginx漏洞隐患(nginx常见故障)
- 2024-10-03 nginx-3-默认网站和防盗链(nginx默认访问index.html)
- 2024-10-03 应用安全扫描时NGINX的配置方法(nginx防扫描)
你 发表评论:
欢迎- 08-06linux 和 windows文件格式互相转换
- 08-06谷歌 ChromeOS 已支持 7z、iso、tar 文件格式
- 08-06Linux下比较文件内容的6种方法
- 08-06文件格式及功能汇总
- 08-0610个Linux文件内容查看命令的实用示例
- 08-06Linux-如何区分不同文件类型
- 08-06Zabbix技术分享——监控windows进程资源使用情况
- 08-06Linux系统卡顿?学会ps命令这三招,轻松定位问题进程
- 最近发表
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)