MultiHost Support - One jaws to rul' em all

Author: Pablo Fischer
Author: Jorge Gallegos
Date: June 2nd 2005

What is it about?

Have you ever tried to install Jaws in a server and use it for many users so you only need to have the source code in one place and forget symlinks?.

If your answer is: yes! You will like this proposal.

A common situation

Imagine you have your server under the domain: example.com and have 5 users: ion, imcsk8, kad, helgi and pablo and you love Jaws.

But today you consider Jaws very good and want to give your users the option to use it for their websites, however you consider that installing and keeping up2date Jaws for each user is a pain in the ass. So the only solution you find is installing Jaws via symlinks or installing a tarball of Jaws in each user home:

/home/ion/public_html
/home/imcsk8/public_html
/home/kad/public_html
/home/helgi/public_html
/home/pablo/public_html

Is there a better solution?

Of course!. We have been looking in how other CMS or Blog systems deal with these kind of problems and we found that:

  • Using a different JawsConfig for each user, how we are going to name the JawsConfig? By the domain and path name, so if you have the following domain schema:
http://ion.example.com for pablo
http://imcsk8.example.com for imcsk8
http://kad.example.com for kad
http://helgi.example.com for helgi
http://pablo.example.com for pablo
  • You will need to name them like: ion.example.com.JawsConfig.php, imcsk8.example.com.JawsConfig.php and so on.. Same happens if you have the blog under the same domain but different directory: subdomains and paths are separated by dots.
  • But what happens with the data/ directory if you are going to have only one Jaws installation?. In 0.6 the data/ directory under Jaws code will be named: JAWS_DATA, so ion’s data/ directory will be in /home/ion/public_html/data, how to tell Jaws to do it?:
//Under each JawsConfig.php
define('JAWS_DATA', '/home/ion/public_html/data');
  • If JAWS_DATA is not defined then Jaws will define it using the JAWS_PATH and appending the ‘data’ directory, so if you have Jaws under /usr/share/jaws, the default data directory will be: /usr/share/jaws/data.
  • But JAWS_DATA can be also defined in a .htaccess or in httpd.conf.

So, using the last solutions the sysadmin can keep a secure Jaws by just having a /usr/share/jaws installation and a separate data/ and JawsConfig.php (based in domain/path naming).

And in the real world...

Now that we know how to fix this problem and have only one Jaws to rul’ em all, we can fix it by unpacking the jaws tarball under /usr/share/jaws and opening our httpd.conf file:

#For ion
<VirtualHost *>
        ServerAdmin sysadmin@example.com
        DocumentRoot /usr/share/jaws
        ServerName ion.example.com
        CustomLog /var/log/apache/ion-log common
        UserDir /usr/share/jaws
        ServerPath /usr/share/jaws
        #Tell Jaws where data/ directory is
        SetEnv JAWS_DATA "/home/ion/public_html/data"
        #An alias so users can access to data/ but using the JAWS_DATA
        Alias /data /home/ion/public_html/data
</VirtualHost>
 
#For kad
<VirtualHost *>
        ServerAdmin sysadmin@example.com
        DocumentRoot /usr/share/jaws
        ServerName kad.example.com
        CustomLog /var/log/apache/kad-log common
        UserDir /usr/share/jaws
        ServerPath /usr/share/jaws
        #Tell Jaws where data/ directory is
        SetEnv JAWS_DATA "/home/kad/public_html/data"
        #An alias so users can access to data/ but using the JAWS_DATA
        Alias /data /home/kad/public_html/data
</VirtualHost>
 
  /var/www/wiki/htdocs/data/jaws/proposals/multihost.txt · Last modified: 2007/11/02 16:27