Skip to content

Commit 63d5c23

Browse files
committed
2018-07-11 补充 nginx log 切分
1 parent 1b0204d commit 63d5c23

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

markdown-file/Nginx-Install-And-Settings.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,11 +684,12 @@ location ~ .*$ {
684684
### Nginx 自动分割日志文件
685685

686686
-[Tomcat 安装和配置、优化](Tomcat-Install-And-Settings.md) 文章已经使用了 cronolog,这里也借用 cronolog 来实现分割。具体安装看文章。
687+
- 创建目录:`mkdir -p /data/nginx/log/logs`
687688
- 创建命名管道:`mkfifo /data/nginx/log/access_log.log`
688689
- 配置 cronolog(按天):`nohup cat /data/nginx/log/access_log.log | /usr/sbin/cronolog /data/nginx/log/logs/access-%Y-%m-%d.log &`
689690
- 配置 cronolog(按月):`nohup cat /data/nginx/log/access_log.log | /usr/sbin/cronolog /data/nginx/log/logs/access-%Y-%m.log &`
690691
- 编辑 nginx 配置文件,配置 log 位置:`access_log /data/nginx/log/access_log.log;`
691-
- 重启 nginx
692+
- 重启 nginx,最终可以在 /data/nginx/log/logs 目录下看到生成的 log
692693

693694
### Nginx 处理跨域请求
694695

0 commit comments

Comments
 (0)