location /api { expires 12h; if ($request_uri ~* "(php|jsp|cgi|asp|aspx)") { expires 0; } proxy_pass http://www.xxx.com:8080/; proxy_set_header Host www.xxx.com; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; add_header Cache-Control no-cache; add_header X-Cache $upstream_cache_status; proxy_set_header Accept-Encoding ""; sub_filter_once off; #开启缓存 #proxy_cache cache_one; #proxy_cache_key $host$uri$is_args$args; #proxy_cache_valid 200 304 301 302 12h; }