刘小帅

Nginx.conf
# For more information on configuration, see: # * Offic...
扫描右侧二维码阅读全文
28
2019/10

Nginx.conf

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
worker_rlimit_nofile 65535;
include /usr/share/nginx/modules/*.conf;
events {
    use epoll;
    multi_accept on;
    worker_connections 65535;
}
http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;
    proxy_connect_timeout 300;
    proxy_send_timeout 300;
    proxy_read_timeout 300;
    proxy_buffer_size 256k;
    proxy_buffers 128 32k;
    proxy_busy_buffers_size 512k;
    proxy_temp_file_write_size 256k;
    proxy_max_temp_file_size 128m;
    proxy_redirect off;
    proxy_headers_hash_max_size 51200;
    proxy_headers_hash_bucket_size 6400;
    proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;


    proxy_temp_path  /dev/shm/proxy_temp;
    proxy_cache_path /dev/shm/proxy_cache levels=1:2 keys_zone=cache_one:300m inactive=1d max_size=1g;

    gzip  on;
    gzip_min_length  1k;
    gzip_buffers     16 16k;
    gzip_http_version 1.1;
    gzip_comp_level 2;
    gzip_types       text/plain application/x-javascript text/css application/xml; 
    gzip_vary on;
    
    limit_req_zone $binary_remote_addr zone=one:10m rate=5r/s;
    limit_conn_zone $binary_remote_addr zone=addr:10m;
    server_tokens off;  #隐藏nginx的版本号
    server_names_hash_bucket_size 512;

    client_header_buffer_size 256k;
    large_client_header_buffers 4 256k;

    #size limits
    client_max_body_size    50m;
    client_body_buffer_size 256k;
    client_header_timeout   3m;
    client_body_timeout 3m;
    send_timeout   3m;
    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/kis/站点配置文件/*.conf;  #导入相关子配置文件
    include /etc/nginx/kis/站点配置文件/qipaiguanwang/*.conf;  #导入相关子配置文件
}

log_format  main  '[\$time_local] \$http_host "\$request" \$remote_addr \$remote_user '
                      '\$status \$body_bytes_sent "\$http_referer" "\$http_user_agent" '
                      '"\$http_x_forwarded_for" \$request_time \$upstream_response_time '
                      '"\$upstream_addr" \$upstream_status';


Last modification:November 16th, 2019 at 08:42 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment