메뉴 건너뛰기

KIM0.COM

Nginx Nginx - error log critical options (disk full)

2014.08.21 14:46

Kim 조회 수:5492

error 로그가 하염없이.. 생겨서 디스크 풀이 날경우가 있습니다.
필자가 실제로 당해본..ㅠㅠ 
[root@yongbok ~]# df -h /dev/ad4s1a
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ad4s1a     38G     38G   -2.9G   108%    /

nginx.conf 의 http 구문에 error_log 변수에 로그의 critical한 부분만 로깅을 할수 있도록 설정 하면 됩니다.
#----------------------------------#
user  www;
pid        logs/nginx.pid;
#----------------------------------#
#worker_rlimit_nofile 51200;
worker_processes  2;          # number of CPU core
events {
    worker_connections 1024;
    use kqueue;
    # FreeBSD - kqueue
    # Linux - epoll
}
#----------------------------------#

http {
    include       mime.types;
    default_type  application/octet-stream;
    access_log off;
    error_log log/error.log crit;


    ## Size Limits
    client_body_buffer_size   5m;
    client_header_buffer_size 5m;
    client_max_body_size      5m;
    large_client_header_buffers 8 8m;

    ## Timeouts 
    client_body_timeout   5;
    client_header_timeout 5;
    send_timeout          5;
    
    # Keep Alive
    keepalive_timeout 0;    
    #keepalive_requests 5;
    #keepalive_timeout  15; 

    ## General Options
    ignore_invalid_headers   on;
    limit_zone gulag $binary_remote_addr 1m;
    recursive_error_pages    on;
    reset_timedout_connection on;
    server_names_hash_bucket_size 128;
    sendfile                 on;
    server_name_in_redirect off;
    server_tokens           off;
    aio on;
    directio 64m;

    ## TCP options  
    tcp_nodelay on;
    tcp_nopush  on;

     ## Compression
    gzip              on;
    gzip_vary         on;
    gzip_static       on;
    gzip_buffers      16 1m;
    gzip_comp_level   9;
    gzip_http_version 1.1;
    gzip_min_length   0;
    gzip_types        text/css text/xml application/x-javascript application/atom+xml application/rss+xml text/plain image/x-icon application/java-archive application/msword application/pdf application/vnd.ms-excel application/vnd.ms-powerpoint application/vnd.wap.xhtml+xml application/x-xpinstall;

    ## Expires
    #expires       1y;
    #add_header    Cache-Control  private;

    ## GEOIP
    geoip_country    /usr/local/share/GeoIP/GeoIP.dat;
    #geoip_city    /usr/local/share/GeoIP/GeoLiteCity.dat;
    
    geo $country {
    default no;
    include nginxGeo.txt;
    }

    ## add header
    add_header Admin    김용복;
    add_header E-Mail    ruo91@yongbok.net;

    #upstream backend {
    #server apache.yongbok.net:81;
    #server mysql.yongbok.net:81;
    #}
    include vhosts/*.conf;

}