worker_processes 8; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid;events { worker_connections 65535;} http { include mime.types; default_type application/octet-stream; log_format main ' $remote _addr - $remote _user [$time _local] "$request" " ' $status $body _bytes_sent "$http _referer ' ' "$http _user_ Agent " " $http _x_forwarded_for "&nbsP; " $upstream _cache_status " " $host " " $request _time "; access_log logs/ access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; resolver 8.8.8.8; #gzip on;client_body_buffer_size 512k; proxy_ connect_timeout 5; proxy_read_timeout 60; proxy_send_timeout 5; proxy_buffer_size 16k; proxy_buffers 4 64k; proxy_busy_buffers_size 128k; proxy_temp_file_write_size 128k;proxy_temp_path /data/tmp;proxy_cache_path /data/cache1 levels=1:2 keys_zone=cache_1:200m inactive=365d max_size=112g use_temp_path=off;proxy_cache_path /data/cache2 levels=1:2 keys_zone=cache_2:200m inactive=365d max_size=120g use_temp_path=off;proxy_cache_path /data/cache3 levels=1:2 keys_zone=cache_3:200m inactive=365d max_size=120g use_temp_path=off;proxy_ Cache_path /data/cache4 levels=1:2 keys_zone=cache_4:200m inactive =365d max_size=120g use_temp_path=off;proxy_cache_path /data/cache5 levels=1:2 keys_zone=cache_5:200m inactive=365d max_size=120g use_temp_path=off;split_ clients $request _uri $disk { 20% 1; 20% 2; 20% 3; 20% 4; 20% 5;} #server {# listen 80 default_server;# server_name _;# location / {# return 403;# }#}server { listen 80; # server_name hpcc-page.cnc.ccgslb.com.cn img3.2345.com; location / { proxy_set_header accept-encoding ""; proxy_pass http://$host; proxy_cache_key $request _uri; proxy_cache cache_$disk; proxy_cache_valid 200 302 1d; proxy_cache_ valid 404 1d; #aio threads= pool_$disk; add_header nginx-cache "$upstream _cache_status"; sendfile on; } location /nginx_ status { stub_status on; access_log off; allow 127.0.0.1; deny all; }}}
Companies need to do cache, squid because long time useless, but also re-learn, choose Nginx, before all is a single block, this time with a lot of disk cache, found very useful, and more simple than squid.
Here are some data on the hard drive graph and Tsar monitoring
This article is from "become a cyber Security Engineer" blog, please make sure to keep this source http://luyafei.blog.51cto.com/1092421/1833596
Nginx Multi-disk cache