Score:0

How to properly cache content in NGINX like in Plus version?

fr flag

I saw official NGINX tutorial regarding content caching and tried to modify it according to my needs. I use CDN (Cloudfront), but the performance doesn't convince me. If my server was more faster it'd do better in Core Web Vitals or Page Experience in issues related to server response time and more. I need a global content caching system in my server to reduce workload and improve performance, that's why I even bought additional storage in my server. Neither nginx -t command is helpful, 'cause it doesn't detect anything 'abnormal'.

My nginx.conf

...
http {
...
        proxy_cache_path /var/nginx/data keys_zone=mycache:10m;
        server {
                proxy_cache mycache;
                location / {
                proxy_pass http://localhost:8000;
                proxy_cache_valid 200 302 10m;
                proxy_cache_valid 404      1m;
                }
              }
...
}
...

The config above isn't working. I expected to see some data/cache in the folder reserved for caching system, but is empty. What should I do?

djdomi avatar
za flag
is not working is not an error description. your config tell to cache for 10 minutes. Please show us with logs what is not working in your mind
AtomX avatar
fr flag
I don't see anything in the cache folder. It's empty
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.