start by creating the needed directorys and changing the permission to the nginx proccess (www-data on ubuntu)
mkdir -p /var/cache/nginx/sks /var/cache/nginx/temp
chown -R www-data:www-data /var/cache/nginx
Below is my config.
http {
...
proxy_ignore_headers Expires Cache-Control;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_path /var/cache/nginx/sks levels=1:2 keys_zone=keyserver:10m max_size=10g inactive=6h;
proxy_temp_path /var/cache/nginx/temp;
...
}
Then in the Server secion, I have
location /pks {
proxy_cache keyserver;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_valid 200 301 302 6h;
proxy_cache_valid 404 502 503 504 1m;
proxy_pass http://127.0.0.1:11371;
add_header Via "1.1 keyserver.mattrude.com:11371 (nginx)";
proxy_ignore_client_abort on;
client_max_body_size 8m;
}