ActiveCollab with Nginx + APC Cache

From more than 3 years, we are using ActiveCollab to manage our 600+ clients and 900+ projects (as of today).

Over the time, as our data grew we needed to tweak ActiveCollab. We managed to speed-it up using Nginx (with proper browser caching) and PHP’s APC cache. We are using Nginx from almost 2-years now so you can count on following steps… 😉

Changes to ActiveCollab Config for Clean-URLs

These changes are necessary if you like to remove /public/index.php from URLs. Before making any changes, please take necessary backups.

Goto activecollab setup’s config/config.php

#1. Change

define('ROOT_URL', 'http://ac.example.com/public');

To

define('ROOT_URL', 'http://ac.example.com');

#2. Then add following 4 lines:

define('URL_BASE', ROOT_URL . '/');
define('ASSETS_URL', ROOT_URL . '/public/assets');
define('PUBLIC_AS_DOCUMENT_ROOT', true);
define('PATH_INFO_THROUGH_QUERY_STRING', false);

Nginx Config

Below is a sample nginx-config we use. Please replace ac.example.com with your domain on which you are hosting your activeCollab. You will also need to change few more parameters to match your system paths/config. Following uses our nginx-setup conventions documented here.

server {
        server_name     ac.example.com;

ADVERTISEMENT
access_log /var/log/nginx/ac.example.com.access.log; error_log /var/log/nginx/ac.example.com.error.log; root /var/www/ac.example.com/htdocs/public; index index.php ; location / { try_files $uri $uri/ /index.php?path_info=$uri&$args; access_log off; expires max; } location ~ \.php$ { try_files $uri =404; include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9000; }
ADVERTISEMENT
location = /favicon.ico { try_files /brand/favicon.ico =404; access_log off; log_not_found off; expires max; } location ~ /\. { deny all; access_log off; log_not_found off; } #fix old ticket URLs. Uncomment if you are coming from AC2 to AC3 #rewrite ^/projects/([^/]+)/tickets/([^/]+)/?$ http://ac.rtcamp.com/projects/$1/tasks/$2 permanent; #rewrite ^/projects/([^/]+)/tickets/? http://ac.rtcamp.com/projects/$1/tasks/ permanent; }

From activeCollab 2 to activeCollab 3,  tickets were renamed to tasks. Last 2 lines can take care of old permalinks in old mails/documents.

That’s all you need to get activeCollab running on Nginx. 🙂

APC Cache

If you have PHP installed with APC Cache support, then you just need to add one line to activeCollab’s config/config.php

define('CACHE_BACKEND', 'APCCacheBackend');

Above will enable APC cache support but to get proper speed-up you must change APC’s default storage limit from 32MB to minimum 100MB. You can do that by following this article.

APC cache alone can improve performance significantly provided its large enough to accomodate as many entries activeCollab wants to store there.

Recommended: WordPress-Nginx Tutorial Series

(Last Updated on Oct 28, 2012 by nice suggestions from Blaise Laflamme)