Nginx配置清單-生產環境

user www www;
worker_processes auto;
worker_cpu_affinity auto;

error_log /data/wwwlogs/error_nginx.log crit;
pid /var/run/nginx.pid;
worker_rlimit_nofile 51200;
pcre_jit on;
worker_aio_requests 32;

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

http {
    include mime.types;
    default_type application/octet-stream;
    log_format  main  '$geoip_country_name $server_name $remote_addr - $remote_user [$time_local] "$request" '
                          '$status uptream_status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for" '
                          '$ssl_protocol $ssl_cipher $upstream_addr $request_time $upstream_response_time';
    
	geoip_country    /usr/local/geoip/GeoIP.dat;
    server_names_hash_bucket_size 128;
    sendfile on;
    tcp_nopush on;
    keepalive_timeout 120;
    server_tokens off;
    tcp_nodelay on;
    
    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
    fastcgi_buffer_size 64k;
    fastcgi_buffers 4 64k;
    fastcgi_busy_buffers_size 128k;
    fastcgi_temp_file_write_size 128k;
	fastcgi_cache_path /tmp/nginx_cache levels=1:2 keys_zone=microcache:10m max_size=500m;
	fastcgi_cache_key "$scheme$request_method$host$request_uri";
	
	
    proxy_connect_timeout    5;  
    proxy_read_timeout       10;  
    proxy_send_timeout       10;  
    proxy_buffer_size        4k;        ##等同於系統單個內存頁面大小(getconf PAGE_SIZE)
    proxy_buffering 	     on;
    proxy_buffers         320 4k;       ## number  size  (size 同上)
    proxy_busy_buffers_size 128k;       ## 設置爲proxy_buffers 兩倍  
    proxy_temp_file_write_size 128k;  
    proxy_temp_path   /usr/local/nginx/proxy_temp;  
    proxy_cache_path /usr/local/nginx/proxy_cache levels=1:2 keys_zone=content:20m inactive=1d max_size=100m loader_threshold=300 loader_files=200 ;
 
    gzip on;
    gzip_buffers 16 8k;
    gzip_comp_level 6;
    gzip_http_version 1.1;
    gzip_min_length 256;
    gzip_proxied any;
    gzip_vary on;
    gzip_types
        text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
        text/javascript application/javascript application/x-javascript
        text/x-json application/json application/x-web-app-manifest+json
        text/css text/plain text/x-component
        font/opentype application/x-font-ttf application/vnd.ms-fontobject
        image/x-icon;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    open_file_cache max=1000 inactive=20s;
    open_file_cache_valid 30s;
    open_file_cache_min_uses 2;
    open_file_cache_errors on;
	
	# Configure buffer  size
	client_header_buffer_size 4k;
    client_max_body_size 8m;
	client_body_buffer_size 16k;
	large_client_header_buffers 4 32k;
	
	#Configure Timeouts
	client_body_timeout 12;
	client_header_timeout  12;
################# new upstream ################
    upstream apisvc {
            ip_hash;
            server  10.169.25.50:5433  weight=1 max_fails=2 fail_timeout=5s;  ##GLMS2 5433
            keepalive 32;
    }
########################## vhost #############################
    include vhost/*.conf;
    include proxy.conf;
    include vhost/ssl/*.conf;
	include vhost/performence/*.conf;
}

https://github.com/yangvipguang/Full_Nginx_conf/edit/master/nginx.conf

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章