Operating System & Version
CentOS 7
cPanel & WHM Version
96

deddy

Well-Known Member
Oct 13, 2003
147
1
168
We have installed and activated the new Nginx Cache.

The first question is:

Where can we change the proxy default cache time?

We have also installed a Nginx Cache plugin with the following settings:

Cache Zone Path: /var/cache/ea-nginx/proxy/the_real_username
X Automatically flush the cache when content changes

Cache could not be purged. Filesystem API could not be initialized.

The second question is:

What is the correct proxy_cache_path ?

Thank you.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
13,329
2,102
363
cPanel Access Level
Root Administrator
Hey there! The proxy_cache time value is handled by the proxy_cache_valid variable that is typically set up in /etc/nginx/conf.d/includes-optional/users/username.conf. This area is also what is used to store the cached data.

To make a global change to this value, you can edit the /etc/nginx/ea-nginx/cache.json file, and then run this command to configure the changes:

Code:
/scripts/ea-nginx config --all
Let me know if that helps!
 
  • Like
Reactions: RobinF28

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
13,329
2,102
363
cPanel Access Level
Root Administrator
I also see you mentioned a plugin for this, and I can't really comment on that since cPanel doesn't make an official plugin for those settings. You may want to try disabling that and either going with a manual configuration only, or only using the plugin, as there could be conflicts between them.
 

keatliang2005

Registered
May 14, 2021
3
0
1
Malaysia
cPanel Access Level
Root Administrator
since this thread is about WHM 96 Nginx reverse proxy with cache

i have specific setup/environment issue

example:
i have a root site as example.com which is CMS eg. wordpress
and another web app app.example.com , which serve dynamic/personalised content after login

With the default setup, i understand both will run via proxy + cache

from the siege A/B test
wordpress improve transaction two fold
where the web app/api suffer

so to solve this i was thinking disable cache for app.example.com, only enable example.com run via the reverse proxy

after i understand, the enable/disable function is entire account [all domain], i didn't see any exception.

So my question is:
are we able to partially disable some sub or parked domain ?
 

keatliang2005

Registered
May 14, 2021
3
0
1
Malaysia
cPanel Access Level
Root Administrator
Do you mean to disable nginx on certain domains or to disable the caching?
both by directly serving by apache
eg:

example.com which is wordpress, run on reverse_proxy + cache
while: api.example.com directly run on apache, since there no real benefits run via reserver_proxy + cache cause the content is individualise and different every time.

but this is my observation from my initial testing, from trying out the feature because API suffer performance drop, while wordpress site improved.
 

pixelaté

Member
May 21, 2008
8
1
53
We have also installed a Nginx Cache plugin with the following settings:

What is the correct proxy_cache_path ?

Thank you.
I've installed the cache and it's really quick! However, it's also useless. My users can't control or configure it. There's no way for users to purge or refresh the cache after an update. They can't tell the server to ignore particular pages.

Nginx has the ability to be controlled via a URL (as per @deddy post) but none of the WordPress plugins I've tried work with it.
 

reholmes27

Member
Aug 31, 2014
10
3
53
cPanel Access Level
Root Administrator
I have activated Nginx on my server and generally it is working well, however, the main Wordpress issue I'm facing is that once logged in the front end pages don't show the admin bar, unless cache is cleared. Does anyone have any configuration that will detect if user is logged in and not then deliver nginx cache version?
 

LEOPARDhost

Member
Oct 1, 2021
9
2
3
NSW, Australia
cPanel Access Level
DataCenter Provider
Until clients are able to flush the cache, disable it all together, or manage it from any cache plugin for WordPress, we won't be using it.
We have submitted a Feature Request for this, and already within weeks it has 4 upvotes.

cPrex says that it should receive comment from a Product Owner shortly, and clearly there is plenty of need for this functionality.

https://features.cpanel.net/topic/2...mple-plugin-to-purge-from-within-wordpress-wp

Our clients are not the least bit happy that this doesn't already exist natively!

(and cPanel have said we can't develop it ourselves)
 
  • Like
Reactions: cPRex

LEOPARDhost

Member
Oct 1, 2021
9
2
3
NSW, Australia
cPanel Access Level
DataCenter Provider
Until clients are able to flush the cache, disable it all together, or manage it from any cache plugin for WordPress, we won't be using it.
We've now published a WordPress Plugin that provides a one-click Purge NGINX Cache button in the admin top bar:

https://github.com/LEOPARD-host/TNC-WP-Toolbox

It needs a cPanel API Token to be set in a static file above public_html for it to work. Hopefully it helps others. Thanks!

They can't tell the server to ignore particular pages.
I believe this can be done via .htaccess directives at the moment per the Documentation:

https://docs.cpanel.net/knowledge-base/web-services/nginx-with-reverse-proxy/#caching > Use htaccess to manage caching