ea-nginx reverse proxy and clearing cache on triggered reload
Hello. We are trying to implement ea-nginx reverse proxy with caching.
While it works perfectly for a couple of hours at some point the service got reloaded and all the cache is cleared.
сеп 05 11:35:48 g3.theworkpc.com systemd[1]: Starting nginx - high performance web server...
сеп 05 11:35:49 g3.theworkpc.com systemd[1]: Started nginx - high performance web server.
сеп 05 12:06:53 g3.theworkpc.com systemd[1]: Reloading nginx - high performance web server.
сеп 05 12:06:53 g3.theworkpc.com systemd[1]: Reloaded nginx - high performance web server.
сеп 05 12:08:49 g3.theworkpc.com systemd[1]: Reloading nginx - high performance web server.
сеп 05 12:08:49 g3.theworkpc.com systemd[1]: Reloaded nginx - high performance web server.
сеп 05 12:09:42 g3.theworkpc.com systemd[1]: Reloading nginx - high performance web server.
сеп 05 12:09:42 g3.theworkpc.com systemd[1]: Reloaded nginx - high performance web server.
сеп 05 12:10:49 g3.theworkpc.com systemd[1]: Reloading nginx - high performance web server.
сеп 05 12:10:49 g3.theworkpc.com systemd[1]: Reloaded nginx - high performance web server.
To summarize: Caching worked between 11:35:49 and 12:06:53 when the service got reloaded.
I tried entering limits even smaller than 1 day (23h) and the issue still persists.
Here is my cache.json config:
{
"enabled" : true,
"inactive_time" : "128d",
"levels" : "1:2",
"logging" : false,
"proxy_cache_background_update" : "on",
"proxy_cache_lock" : "off",
"proxy_cache_min_uses" : 1,
"proxy_cache_revalidate" : "off",
"proxy_cache_use_stale" : "error timeout http_429 http_500 http_502 http_503 http_504",
"proxy_cache_valid" : {
"200" : "128d"
},
"x_cache_header" : true,
"zone_size" : "100m"
}
Can we solve that issue. What may be triggering this?
We would like to keep the cache for longer periods (128days for example)
I saw similar behavior in that link but it seems that there is not a solution for it: https://support.cpanel.net/hc/en-us/community/posts/19164316453527-What-type-of-events-or-periodic-task-trigger-Cpanel-NGINX-with-Reverse-Proxy-to-delete-the-cached-files?input_string=ea-nginx%20reverse%20proxy%20and%20clearing%20cache%20on%20triggered%20reload
We are running AlmaLinux 8.8 with Cpanel 122.0 (build 5) but it happened on varios other RHEL based OSs.
Thanks in advance.
-
Hey there! After you updated the conf.json file, did you run this command?
/scripts/ea-nginx conf --all
That would save the changes and reload the service.
However, I'm not sure any service will let you use cache after the service has been reloaded, which will happen frequently on a cPanel server. Picture a MySQL database, for example - if you have cached tables, and stop the service, that table cache gets cleared - nginx is no different. Any action in cPanel or WHM that changes user data and triggers an Apache/nginx restart will reload the server and dump the cache.
Since that's the case, configuring the time to be 128 days is completely possible, but other mechanisms will likely clear that cache sooner.
0
Please sign in to leave a comment.
Comments
1 comment