nginx基础配置

#nginx基础配置
user  webapp webapp;
worker_processes  auto;
worker_cpu_affinity auto;

error_log  /var/log/nginx/error.log debug;
pid        /var/run/nginx.pid;


worker_rlimit_nofile 100000;


events {
    use epoll;
    multi_accept on;
    worker_connections  100000;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    open_file_cache max=100000 inactive=20s;
    open_file_cache_valid 30s;
    open_file_cache_min_uses 2;


     log_format main '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" $host'
                      '"$host$uri" "$request_uri" "$realpath_root" '
                      '"$http_user_agent" $http_x_forwarded_for "$upstream_addr" "$http_Cookie" $arg_name';

     log_format access '{"@timestamp":"$time_iso8601",'
            '"ip":"$remote_addr",'
                    #'"client_ip":"$http_x_forwarded_for",'
                    '"method":"$request_method",'
                    '"status":"$status",'
                    '"size":$body_bytes_sent,'
                    '"domain":"$host",'
                    '"requesturi":"$request_uri",'
                    '"url":"$host$uri",'
                    '"responsetime":$request_time,'
                    '"upstream_addr":"$upstream_addr",'
                    '"referer":"$http_referer",'
                    #'"@timestamp":"$time_iso8601",'
                    '"Cookie":"$http_Cookie",'
                    '"ddh":"$http_ddh",'
                    '"corpid":"$http_corpId",'
                    '"http_type":"$scheme",'
                    '"root_path":"$realpath_root",'
                    '"tcp_number":"$connection_requests",'
                    '"agent":"$http_user_agent"}';

    access_log  /var/log/nginx/access.log  main;


   charset  utf-8;

   server_names_hash_bucket_size 128;
   client_header_buffer_size 2k;
   large_client_header_buffers 4 4k;
   client_max_body_size 30m;

    sendfile        on;
    tcp_nopush     on;
    tcp_nodelay on;
    keepalive_timeout  65;

    proxy_buffering    off;
    proxy_buffer_size  128k;
    proxy_buffers 100  128k;


   gzip on;
   gzip_min_length  1k;
   gzip_buffers     4 16k;
   gzip_http_version 1.0;
   gzip_comp_level 2;
   gzip_types       text/plain application/x-javascript text/css application/xml;
   gzip_vary on;

    include /usr/local/nginx/conf.d/*.conf;
}

posted on 2019-02-21 21:13  myworldworld  阅读(91)  评论(0)    收藏  举报

导航