Posted by DrakeTaylor on August 1, 2011 at 5:15pm
I have a 256meg slice on slicehost running a drupal 6 site using nginx and APC. Everything works perfectly. However, I want to add a private site just for me and have that site not be cached by APC. I've searched online and found how to do it using apache, but not nginx. Any ideas on how to get APC to cache only the public site?
Thanks.
Comments
Are you talking about code
Are you talking about code cache or data cache?
You can exclude code by stating some unique part of its path in /etc/php5/conf.d/apc.ini using:
apc.cache_by_default=1apc.filters="-secondsite"
It should be the same for apache.
Thanks Brian, I was thinking
Thanks Brian,
I was thinking more of turning apc off in php.ini and using .htaccess to turn it on for a specific site. But I'll try this instead.
Thanks again!
-Drake
You can try this.
That avoids fiddling with the APC config file.
At the
httpcontext of your Nginx config.map $http_host $apc_state {hostnames;
default "apc.enabled=1";
private.site.com "apc.enabled=0";
}
And now define a
fastcgi_paramlike this:fastcgi_param PHP_ADMIN_VALUE $apc_state;Try it out. It should work. Don't know if it will work with
php-cgi, but should work with a moderately recent version ofphp-fpm.That's a cool way to do it.
That's a cool way to do it.
Even more cooler :)
http {...
map $http_host $apc_state {
hostnames;
default 1;
my.private.site.com 0;
}
...
Then the
fastcgi_param:fastcgi_param PHP_ADMIN_VALUE "apc.enabled=$apc_state";