Cache path for nginx.

paksociety

Verified User
Joined
Jul 11, 2013
Messages
89
Hi
I am using nginx as reverse proxy with apache.
Kindly tell me what is default cache path of nginx cache?
as var/nginx/cache is not a directory.

Or how can i set nginx cache path.

Thanks in Advance
 
been trying to figure that out too, as is no way to customize the caching
 
the problem is,, as installed, nginx proxy to apache is not caching much of anything.
attempts to manually set cache path in any conf/vhost lead to 503 errors.
cannot see why either, doesn't appear to be chmod/chown issue either.
the paid plugins set var/cache/nginx directory during build which does work, and can then enable levels of cache and microcaching desired.
manually building the setup and editing apache port to proxy nginx to apache also works.
just building through CB doesn't, sure sites run but the benefits of using nginx proxy are extremely minimal for some reason.
 
But still the question is open, what do you want to cache with nginx? Maybe static files? Why? Does not your disk cache work properly? PHP scripts? But what about APC? OpCache?
 
static.
I use it alongside apcu, xcache and php5+ opcode cache and it can really help.
its easier to deal with compared to varnish and no cookie/unset issues to deal with like varnish.
On the main site on server I run between 250 and 7000 online at once on a heavy sql site (forum and article/news site with lot of images), the nginx cache used alongside opcode caching helps a lot.
prevents me from needing dedicated sql server when I get traffic slams.
I am (of course) using disc caches and mod_pagespeed but nginx caching is really useful.

its the reason WHY people proxy nginx to apache, and right now its really a waste of complexity as is as its not working as well as it should.
 
I'm really wondering how do you win from caching static in nginx? I'd rather get static directly from public_html without triggering apache, but that brings limits on using of .htaccess, which won't be honored in the case. The same in your case if to store static files in nginx cache might bring issues when you need to limit access to files depending on a variety of criterias set in .htaccess file.

Anyway feel free to modify your installation to meet your needs according to this: http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache
 
well really it doesn't trigger apache, thats actually one of the benefits.
try it, you'll like it :)
nginx alone is best however (especially on a web control type server like DA) with many sites the configs are a nightmare.
for example I can run owncloud perfectly on nginx on a vps with no panel, try running owncloud on nginx on DA (and cpanel too) and its a nightmare. in fact I cannot get it working, none of the known location block directives actually work.
so the nginx proxy to apache fills a void, works so much easier than varnish, and helps a lot.

have used it as proxy for a long time, until now that is...
considering paying 5$ US a month for DANginx as it does cache right and considering I now, for whatever reason, cannot even get nginx_proxy to run from CB (have a thread on it) as it is worth it.
on light use sites you probably would not see benefits, but when getting slammed you can really see the help it gives.
 
I don't need much nginx cache as in my configuration (I don't use any 3rd party plugins for that either) nginx does serves static files directly from user's homedirs and does proxy requests to apache only for PHP scripts. So disk cache is all what I need here.

What I use from nginx cache is this:

Code:
open_file_cache          max=1000 inactive=20s;
open_file_cache_valid    30s;
open_file_cache_min_uses 2; 
open_file_cache_errors   on;

That configures a cache that can store:
  • open file descriptors, their sizes and modification times;
  • information on existence of directories;
  • file lookup errors, such as “file not found”, “no read permission”, and so on.
http://nginx.org/en/docs/http/ngx_http_core_module.html#open_file_cache

 
Back
Top