nginx 相關問題

Nginx配置文件nginx.conf 參考:http://www.2cto.com/os/201212/176520.htmlhtml

Nginx自動切分日誌:nginx

nignx沒有自動分開文件存儲日誌的機制。shell

shell腳本文件nginx_log_division.sh內容以下:bash

/bin/bash

logs_path="/data/wwwlogs/"spa

之前的日誌文件。

log_name="xxx.log"日誌

pid_path="/usr/local/nginx/logs/nginx.pid"code

mv \({logs_path}\){log_name} \({logs_path}\){log_name}_$(date --date="LAST WEEK" +"%Y-%m-d").loghtm

kill -USR1 cat ${pid_path}get

上面shell腳本的原理是:先把之前的日誌文件移動重命名成一個,目的是就是備份。io

相關文章
相關標籤/搜索