我在静态内容和Last-Modified标头上添加了一个X-Accel-Expires标头.
我想知道什么是正确的设置来缓存这些元素而不缓存其他任何东西.
这是我目前所拥有的,但它没有缓存任何东西:
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;
}
}