zhangpengfei00 发表于 2018-11-8 09:20:59

Nginx缓存开启

user www;  worker_processes auto;
  events {
  worker_connections 4096;
  }
  http {
  include mime.types;
  default_type application/octet-stream;
  sendfile on;
  gzip on;
  keepalive_timeout 65;
  # 以下是缓存相关配置
  proxy_cache_path /data/nginx/cache2 levels=1:2 keys_zone=mycache:1024m max_size=2048m inactive=1d ;
  server {
  listen 80;
  server_name localhost;
  #charset koi8-r;
  #access_log logs/host.access.log main;
  location /apis/test/img {
  proxy_pass http://192.168.1.2/;
  # 以下三行是缓存相关配置
  proxy_cache mycache;
  proxy_cache_valid 200 1d;
  proxy_cache_use_stale error timeout invalid_header updating http_500 http_503 http_404;
  }
  error_page 500 502 503 504 /50x.html;
  }

页: [1]
查看完整版本: Nginx缓存开启