Caching in NGINX Balancer
This guide has been reviewed and reformatted for Ruk-Com Cloud PaaS. Screens may vary slightly by platform version.
Click or tap a screenshot to view it at its original size.
Objective
This guide explains how to use Caching in NGINX Balancer on Ruk-Com Cloud PaaS, with ordered procedures and practical verification points.
Before you begin
- Sign in with an account permitted to manage the relevant environment.
- Confirm the target environment, region and resources before saving changes.
- Create a backup or rollback plan before changing a production system.
Caching in NGINX is the process of automatically storing data at the web server, for example files that are requested by users. By looking at web pages, they can be stored in your NGINX cache directory. When users return to the web page they just viewed, the browser picks up those files from the NGINX cache directory instead of the original server, saving time and traffic.
Therefore, caching improves performance while accessing resources in two ways:
- Reduce resource access times by copying them closer to the user.
- Speeds up the creation of resources by reducing the number of accesses. For example, instead of creating the home page of your blog with each request, you can store it in the cache.
This guide shows you how to set up the cache on NGINX-balancer in Ruk-Com PaaS
with NGINX-balancer You can use caching to reduce application server load. To do so, follow these steps:
1. Access the Ruk-Com dashboard.
2. Request Ruk-Com Cloud to useCreate Environment

3. Create an Environment with a number of application servers and NGINX as the balancer. Specify the cloudlet limits, type the name of the Environment, and click the Create button.

Within a few minutes your Environment will be created and appear in the list.
4. For cache settings, click the Config button for the NGINX node in your Env and go toconf.d > cache.conf

5. For enabling cache Uncomment the line as shown in the image below.

- proxy_cache_path/var/lib/nginx/cache [levels=levels] keys_zone=name:size
- This command sets the path and other parameters of the cache.
- The levels parameter sets the hierarchy level of the cache.
- The keys_zone parameter configures the name and RAM size of the zone (for example jelastic:32m) - proxy_cachezone | off, where zone - identifier of the cache
This command defines the shared memory zone used for caching. The same zone can be used in many places.
The off parameter disables inherited caching. previous configuration level - proxy_temp_path/var/lib/nginx/tmp [level1 [level2 [level3]]]
This defines the directory for storing temporary files containing data received from the proxy server. A maximum of three levels of subdirectory hierarchy can be used under a specified directory. - proxy_cache_valid{number}m
Specify the time NGINX should keep cash, for example 720m.
To find information about other commands, go tolink.
Tips:
If it is necessary to clear the cache, you can use the directory.proxy_cache_validwith parameter value 0m
6. Save changes and restart the node.
