I was Googling around for some simple page caching solutions (say, cache
pages for 5 minutes, exclude certain directories) and came across Google
results for varnish, memcached, using nginx as a reverse proxy for
apache,
etc.
My Googling didn’t find a method for nginx caching itself, though my
coffee-deficient brain thinks that might still involve using the proxy
directives to point to itself. I dunno, hence the question.
I’m just looking for a way to speed up some dynamic pages that don’t
have
personalization and can basically be static for a few minutes. Dedicated
erver has 2 gig RAM and runs nginx, php-fpm, mysql 5 and a qmail server.
I began to look at it but my brain wasn’t seeing how to set it up for
handling nginx caching itself. It might be safe to assume that this is
because I have a summer cold and headache but still felt the need to
surf
when I couldn’t sleep.
Wow, Mark, thanks. I was doing some testing earlier tonight and a few of
my pages were fast loading on their own but under load they just ground
the system to a halt. So this should help.
How do I turn off the caching for a specific directory? I’ll need to do
that on my phpmyadmin and data entry/update dirs.
fastcgi_cache_path /var/lib/nginx/fastcgicache levels=1:2
fastcgi_param …; and so on ) add these:
Wow, Mark, thanks. I was doing some testing earlier tonight and a
few of my pages were fast loading on their own but under load they
just ground the system to a halt. So this should help.
How do I turn off the caching for a specific directory? I’ll need to
do that on my phpmyadmin and data entry/update dirs.
On Wed, 1 Aug 2012 00:24:12 -0400, “Ian M. Evans” [email protected] wrote:
I’m just looking for a way to speed up some dynamic pages that don’t
have personalization and can basically be static for a few minutes.
Dedicated erver has 2 gig RAM and runs nginx, php-fpm, mysql 5 and a
qmail server.
Any thoughts or config example links?
create dir /var/lib/nginx/fastcgicache and make it readable by nginx
at the very begining of your /etc/nginx/sites-available/yoursite
file (i.e., before the first server { … line) include these 3 lines:
in the block where you pass the control to php-fpm (i.e., the block
were you put include fastcgi_params; fastcgi_pass …;
fastcgi_param …; and so on ) add these:
I set up the cache and restarted nginx. How do I debug it? I ab tested
the front page and it’s still slow with concurrent requests. There seems
to be a few snippets in the cache dir, but not every php file is getting
cached.
I installed the fastcgi caching as per the suggestions in this thread.
Using the add_header X-My-Cache $upstream_cache_status; line I’m able to
confirm by the headers if I’m getting cache hits or misses.
I’ve also got a small handful of directories that I don’t want cached
and as per the thread, they’re marked:
I set up the cache and restarted nginx. How do I debug it? I ab
tested the front page and it’s still slow with concurrent
requests. There seems to be a few snippets in the cache dir, but not
every php file is getting cached.
Use cURL. Add a header with the cache status:
Add a cache miss/hit status header.
add_header X-My-Cache $upstream_cache_status;
to your cache config. Check for this header when doing requests with
cURL.
— appa
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.