摘要: nginx rewrite跳转(高级) 官网 https://nginx.org/en/docs/http/ngx_http_rewrite_module.html 该ngx_http_rewrite_module模块用于使用 PCRE 正则表达式更改请求 URI、返回重定向和条件选择配置。 1.介 阅读全文
posted @ 2023-06-13 15:04 Mrterrific 阅读(69) 评论(0) 推荐(0) 编辑
摘要: nginx location高级实战 location是nginx的核心重要功能,可以设置网站的访问路径,一个web server会有多个路径,那么location就得设置多个。 Nginx的locaiton作用是根据用户请求的URI不同,来执行不同的应用。 针对用户请求的网站URL进行匹配,匹配成 阅读全文
posted @ 2023-06-13 14:24 Mrterrific 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 1.理念 nginx除了支持内置模块,还支持第三方模块,但是第三方模块需要重新编译进nginx。 (重新生成nginx二进制命令) 1.如你的nginx默认不支持https 2.给你的nginx添加echo模块,用于打印nginx的变量。 2.编译添加echo模块 echo-nginx-module 阅读全文
posted @ 2023-06-13 13:51 Mrterrific 阅读(770) 评论(0) 推荐(0) 编辑
摘要: nginx内置变量 官网 https://nginx.org/en/docs/varindex.html 该文档还写明了,这些变量对应了哪些模块。 学这些内置nginx变量,目的是为了在配置文件中使用,如 日志功能会用 url跳转时用 等 $args #请求中的参数值 $query_string # 阅读全文
posted @ 2023-06-13 13:42 Mrterrific 阅读(84) 评论(0) 推荐(0) 编辑
摘要: 连接数监控 官网文档 http://nginx.org/en/docs/http/ngx_http_stub_status_module.html 模块介绍 该ngx_http_stub_status_module模块提供对基本状态信息的访问。 默认情况下不构建此模块,应使用 --with-http 阅读全文
posted @ 2023-06-13 13:38 Mrterrific 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 目录索引、文件下载服务 官网文档 http://nginx.org/en/docs/http/ngx_http_autoindex_module.html 利用nginx实现文件下载服务器 1.参数说明 Syntax: autoindex on | off; Default: autoindex o 阅读全文
posted @ 2023-06-13 10:21 Mrterrific 阅读(387) 评论(0) 推荐(0) 编辑
摘要: 日志切割(shell脚本) nginx日志默认是不切割的,网站运行久了自然生成大量日志,导致单文件的处理,太麻烦,因此工作里一般定期切割,一般按天切割。 -rw-r--r-- 1 root root 2.1G May 8 13:57 front_access.log 先纯手动的去切割日志,备份日志 阅读全文
posted @ 2023-06-13 10:13 Mrterrific 阅读(1329) 评论(0) 推荐(0) 编辑