nginx 的应用记录

nginx增加报文内容打印 待完成

1、增加nginx lua支持模块
2、编写lua脚本,获取传输流
3、配置nginx的配置文件,并刷新
4、测试

1 nginx 配置隐藏版本号:

查看ng信息:curl -I localhost:28080

HTTP/1.1 200 OK
Server: Tengine/2.3.2
Date: Mon, 08 Jun 2020 06:56:21 GMT
Content-Type: text/html
Content-Length: 555
Last-Modified: Thu, 24 Oct 2019 03:55:31 GMT
Connection: keep-alive
ETag: "5db120b3-22b"
Accept-Ranges: bytes

修改配置:

增加配置: server_tokens off;

刷新配置:nginx -s reload

查看ng信息:curl -I localhost:28080

无版本信息了;

HTTP/1.1 200 OK
Server: Tengine
Date: Mon, 08 Jun 2020 07:01:25 GMT
Content-Type: text/html
Content-Length: 555
Last-Modified: Thu, 24 Oct 2019 03:55:31 GMT
Connection: keep-alive
ETag: "5db120b3-22b"
Accept-Ranges: bytes

nginx 关闭日志

下面两个指令配置时候的适用范围 main, http, mail, stream, server, location
access log 关闭
access_log off;
error log 关闭
关闭 error log 千万不要写 error_log off; ,这样错误日志会被写到一个叫做 off的文件中
error_log /dev/null ;

posted @ 2020-06-10 21:49  poor_loser  阅读(141)  评论(0)    收藏  举报