Caching in NGINX Balancer
Caching in NGINX Balancer
NGINX caching stores frequently requested data in front of the web servers. This reduces access time and decreases repeated requests to the application layer, improving performance and lowering backend-server load.
In this article
Caching Benefits
- Reduces access time by storing requested resources closer to the user.
- Improves resource-building speed by reducing repeated backend requests.
- Reduces load on application servers by serving suitable content from the NGINX cache.
Create the Environment
- Log in to the platform dashboard.
- Click Create Environment.

- Create an environment with several application servers and NGINX as the load balancer.
- Set the required cloudlet limits, specify the environment name, and click Create.

Enable NGINX Cache
- Click Config for the NGINX node.
- Navigate to
conf.d > cache.conf.

Uncomment the cache directives in cache.conf as shown in the source configuration.

Cache Directives
proxy_cache_pathSets the cache path and cache parameters.
levelsDefines the hierarchy levels of the cache directory.
keys_zoneDefines the cache-zone name and RAM size, for example
jelastic:32m.proxy_cacheDefines the shared memory zone used for caching. Use
off to disable caching inherited from a previous configuration level.proxy_temp_pathDefines the directory used to store temporary data received from proxied servers. Up to three subdirectory levels can be configured.
proxy_cache_validSpecifies how long NGINX keeps cached content, for example
720m.The source examples use the following directive patterns:
proxy_cache_path /var/lib/nginx/cache [levels=levels] keys_zone=name:size;
proxy_cache zone | off;
proxy_temp_path /var/lib/nginx/tmp [level1 [level2 [level3]]];
proxy_cache_valid {number}m;
Clear the Cache
If the cache needs to be cleared, set the proxy_cache_valid value to 0m.
proxy_cache_valid 0m;
After updating the cache configuration, save the changes and restart the NGINX node.

Expected Result
NGINX stores eligible proxied content in its cache and serves repeated requests from the cached data when applicable, reducing application-server workload and improving resource-access performance.
Important Notes
- Configure NGINX caching in
conf.d > cache.conf. proxy_cache_pathdefines the cache directory and shared-memory zone.proxy_cacheselects the shared cache zone or disables inherited caching.proxy_temp_pathdefines temporary storage for proxied data.proxy_cache_validcontrols cache lifetime.- Set
proxy_cache_validto0mwhen the cache needs to be cleared. - Restart the NGINX node after saving the changes.
