user zhangy users;
worker_processes
error_log /var/vlogs/nginx_error
pid /var/vlogs/nginx
#Specifies the value for maximum file descriptors that can be opened by this process
worker_rlimit_nofile
events
{
use epoll;
worker_connections
}
http
{
include mime
default_type application/octet
#charset gb
server_names_hash_bucket_size
client_header_buffer_size
large_client_header_buffers
client_max_body_size
sendfile on;
tcp_nopush on;
keepalive_timeout
tcp_nodelay on;
fastcgi_connect_timeout
fastcgi_send_timeout
fastcgi_read_timeout
fastcgi_buffer_size
fastcgi_buffers
fastcgi_busy_buffers_size
fastcgi_temp_file_write_size
//============
client_body_buffer_size
proxy_connect_timeout
proxy_read_timeout
proxy_send_timeout
proxy_buffer_size
proxy_buffers
proxy_busy_buffers_size
proxy_temp_file_write_size
proxy_temp_path /usr/local/nginx/proxy_temp;
/*levels設置目錄層次
keys_zone設置緩存名字和共享內存大小
inactive在指定時間內沒人訪問則被刪除在這裡是
max_size最大緩存空間*/
proxy_cache_path /usr/local/nginx/proxy_cache levels=
//============等號中間要加的
gzip on;
gzip_min_length
gzip_buffers
gzip_;
gzip_comp_level
gzip_types text/plain application/x
gzip_vary on;
upstream myselfxtajmd {
server
server
}
server
{
listen
server_name localhost;
index inde index
log_format access
access_log /var/log/test
location /
{
proxy_cache content; //根keys_zone後的內容對應
proxy_cache_valid
proxy_cache_valid any
proxy_cache_key $host$uri$is_args$args; //通過key來hash
proxy_pass http://myselfxtajmd;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X
proxy_set_header X
}
//動態的放過
location ~
{
proxy_set_header Host $host;
proxy_set_header X
proxy_pass http://myselfxtajmd;
}
}
}
上面只是配置的部分內容
nginx proxy_cache
第一層目錄只有一個字符
From:http://tw.wingwit.com/Article/program/Java/gj/201405/30825.html