atp

Atp's external memory

pivotx multi-site setup

How to run multiple blogs under pivotx

While setting up rhoda's blog on tinola I came across a couple of hurdles converting from one site to multiple sites.

The pivotx manual helps with a section on running multiple websites. But not everything works that smoothly. So, here's what I needed to do to make it work.

Firstly, make the "sites" directories for the current and new blog(s)

# go to the pivotx subdirectory of the root of the pivotx installation
cd /var/www/blog/pivotx

# make the sites directories
mkdir -p sites/blog.tinola.com
mkdir sites/rhoda.tinola.com

Then move the existing blog into the new sites subdirectory. The images directory may be at the root of the pivotx install.

mv db ../images sites/blog.tinola.com
cd sites/blog.tinola.com
ln -s ../../templates .

I started by following the instructions and moving the templates directory down into the primary blog. However, that did not work out too well, and the best move is to actually share the directory using a symlink mainly because bits of pivotx still expected a templates directory in the root. 

Now make the corresponding directories in the new blog

cd sites/rhoda.tinola.com
mkdir db images
ln -s ../../templates .

At this point I set up the DNS and virtual servers.

<VirtualHost *:80>
ServerAlias blog.tinola.com
DocumentRoot /var/www/blog
ErrorLog logs/blog.tinola.com-error_log
Customlog logs/blog.tinola.com-access_log combined
</VirtualHost>

<VirtualHost *:80>
ServerAlias rhoda.tinola.com
DocumentRoot /var/www/blog
ErrorLog logs/rhoda.tinola.com-error_log
Customlog logs/rhoda.tinola.com-access_log combined
</VirtualHost>

and then logged in to set up the new blog. That didn't work too well so then I remembered to fix all the permissions on the new blog's directories.

In sites/rhoda.tinola.com

chgrp -R apache *
chown g+w *

Then, to fix the remaining breakage I found by tailing the apache error log that I needed to do this - again in sites/rhoda.tinola.com;

mkdir pivotx 
cd pivotx
ln -s ../../../editor_wysi .
ln -s ../templates templates

Then shift-reload and everything seemed to be ok - until I went to edit a post, and found the editor widget was not working.  All I got was a javascript alert('Real path failed); which is not exactly the most helpful message.At least it was unique and grep told me that this snippet in tiny_mce_gzip.php was at fault.

if (!$cachePath) {
   $msg = "Real Path ".$cachePath." failed";
   die("alert('".$msg."');");
}

Further up;

$cachePath = realpath("../db/cache/");

So in the pivotx root again

mkdir -p db/cache 
chgrp apache db/cache
chown g+w db/cache

 One gotcha. The editor_wysi component uses an eval of javascript generated in tiny_mce_gzip.php. This is cached and will not be reloaded. So if you see "Real path failed" then you need to clear your browser cache after you've fixed the problem, or else you'll end up chasing this round and round until it dawns on you to check the expires time in firebug. Then you feel rather stupid for a bit.

HTH

Written by atp

Saturday 03 December 2011 at 11:59 am

Posted in Linux

Leave a Reply