1. 程式人生 > >NGINX 日誌處理 之六

NGINX 日誌處理 之六

nginx錯誤 processes sta 日誌處理 bytes oca timeout for type

1、定義NGINX錯誤日誌
worker_processes  1;
events {
        worker_connections  1024;
}
error_log  logs/error.log;        #定義日誌路徑,默認級別為error,配置位置main體裏
http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
        include vhost/*.conf;
}

2、定義NGINX訪問日誌

worker_processes  1;
events {
        worker_connections  1024;
}
error_log  logs/error.log;
http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
        log_format  main  ‘$remote_addr - $remote_user [$time_local] "$request" ‘     #只允許在http模塊裏配置,此格式為默認定義
                                            ‘$status $body_bytes_sent "$http_referer" ‘
                                            ‘"$http_user_agent" "$http_x_forwarded_for"‘;

        access_log  logs/access.log  main;     #日誌存放路徑與使用的格式

        include vhost/*.conf;
}

3、NGINX日誌切割

請參考:http://ibm.chick.blog.163.com/blog/static/144201610201621135441819/

NGINX 日誌處理 之六