中间件-Nginx漏洞整改(启用日志功能)
中间件-Nginx漏洞整改(启用日志功能)
💖The Begin💖点点关注,收藏不迷路💖
|
1.1 启用日志功能-记录错误日志
应配置日志功能对错误日志进行记录。
加固步骤:
1、编辑nginx.conf,查看是否存在类似如下配置:
error_log logs/error.log;
2、将文件中error_log前的“#”去掉,记录错误日志。
3、保存并重新加载配置
cd 到nginx的sbin目录;
./nginx -s reload
4、验证结果:
cat /usr/local/nginx/conf/nginx.conf |sed "/\s*#/d"|sed "/^\s*$/d"|grep -i "error_log"
1.2 启用日志功能-记录访问日志
设备应配置日志功能,对访问日志进行记录。
加固步骤:
1、编辑nginx.conf,查看是否存在类似如下配置:
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
2、将文件中log_format 、access_log 前的“#”去掉,记录错误日志。
3、保存并重新加载配置
cd 到nginx的sbin目录;
./nginx -s reload
4、验证结果:
cat /usr/local/nginx/conf/nginx.conf |sed "/\s*#/d"|sed "/^\s*$/d"|grep -i "log_format"
cat /usr/local/nginx/conf/nginx.conf |sed "/\s*#/d"|sed "/^\s*$/d"|sed -n "/access_log\s*logs\/access\.log/p"
💖The End💖点点关注,收藏不迷路💖
|
原文地址:https://blog.csdn.net/qq_41840843/article/details/136303771
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!