proxy_cache_path needs to be configured globally for the nginx-ingress-controller, which means creating or updating the nginx-configuration config map:

apiVersion: v1
kind: ConfigMap
    app: ingress-nginx
  name: nginx-configuration
  namespace: ingress-nginx
  http-snippet: "proxy_cache_path /tmp/nginx_cache levels=1:2 keys_zone=mycache:32m use_temp_path=off max_size=4g inactive=24h;"

And then in each ingress, a server-snippet annotation needs to be added to turn on caching for that ingress:

apiVersion: extensions/v1beta1
kind: Ingress
  name: example-ingress
  annotations: nginx "true" / 8m "on" |
      proxy_cache mycache;
      proxy_cache_lock on;
      proxy_cache_valid any 60m;
      proxy_ignore_headers Cache-Control;
      add_header X-Cache-Status $upstream_cache_status;

See the linked references for other proxy-related options that can be set. It's also useful to look at the nginx.conf generated by the nginx-ingress-controller to see what it's already setting and where your config goes. Some configurations just aren't possible without using a custom template or your own nginx.conf.

WARNING: Be sure to test any sites using this configuration and check for issues like being unable to log in, or users able to access restricted areas without logging in.