I have added a X-Accel-Expires header on my static contents as well as a Last-Modified header. I would like to know whats the correct setting to cache those elements without caching anything else.
This is what I have at the moment but it doesn't cache anything :
http {
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log;
sendfile on;
client_max_body_size 2000m;
keepalive_timeout 65;
tcp_nodelay on;
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
ssl_certificate /etc/nginx/chain.pem;
ssl_certificate_key /etc/nginx/key.key;
proxy_cache_path /var/lib/nginx/cache levels=1:2 keys_zone=cache:30m max_size=1G;
proxy_temp_path /var/lib/nginx/proxy 1 2;
proxy_cache_use_stale error timeout invalid_header http_502;
server {
listen 80;
server_name domain;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 700;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}