create an SPIP Farm using mutualisation

On Thu, Feb 26, 2009 at 4:09 AM, Martín Gaitán <gaitan@gmail.com> wrote:

Another option exists and may be easier to maintain :
it's using one installation of SPIP for several websites.
(a plugin makes it really easy
: La mutualisation facile : modifications manuelles )

.Gilles

I've tried the mutualization and I must say it works as a charm. I think I
gonna implement it on my futures sites.

http://granja.nqnwebs.com
http://granja2.nqnwebs.com

Both are over the same shared spip core. Great!

Now a question: How I could mutualize site under a subdirectory of a root
site?

for example:
myspip.com/spip1
myspip.com/spip2
myspip.com/anotherspip

thanks.
Martin

I've sent this mail a few days ago, but just to Gilles (I did the
"reply" mistake).

I'm trying to do a 'public spip farm' using mutualisation. Users could
register an get your own spip (with commons plugins an squelettes) to
use as blog or whatever.

My problem is that I can't create a subdomain for each new site (I
need to it manually on my hosting), although I could create a simbolic
link automaticly that call the directory where the mutualized spip is
installed. These look like directories for a domain.

http://myspip.com/spip1
http://myspip.com/spip2
and so on...

When I try to install a mutualized spip from a subdirectory, the
Mutualization plugin recognize just the domain, because it uses
$_SERVER['HTTP_HOST'] to know which site the user want to create or visit.

So, I want to hack it to give support to subdirectories, but I failed
with my attemps. The idea is read the full URL (domain + subdirectory)
and replace "/" by "-" to convert it to a valid name for spip.

For example

I replace
$site = str_replace('www.', '', $_SERVER['HTTP_HOST']);

by

$site = str_replace('www.', '', $_SERVER['SCRIPT_URI']);
$site = str_replace('http://', '', $site);
$site = substr($site, 0, -1);
$site = str_replace('/', '-', $site);

If I call it from http://nqnwebs.com/newsite by default mutualization
try to create 'sites/nqnwebs.com' but with this hack it's
'sites/nqnwebs.com-newsite' that it's a valid directory.

The problem, of course, is then it fail with redirectioning.

Well, any help will be very appreciated for me, and if it works, for
future spip users.

thanks
martin

Maybe what you need is to configure apache to point all of your
myspip.com/spip1
myspip.com/spip2
myspip.com/anotherspip
to the spip root folder with some aliases:

Alias /spip1 /var/www/spip
Alias /spip2 /var/www/spip
Alias /anotherspip /var/www/spip

That's what I've done in my shared SPIP configuration, even if I didn't used the plugin.

Renato

Martín Gaitán ha scritto:

Now a question: How I could mutualize site under a subdirectory of a root
site?

for example:
myspip.com/spip1
myspip.com/spip2
myspip.com/anotherspip

thanks.
Martin

When I try to install a mutualized spip from a subdirectory, the
Mutualization plugin recognize just the domain, because it uses
$_SERVER['HTTP_HOST'] to know which site the user want to create or visit.

So, I want to hack it to give support to subdirectories, but I failed
with my attemps. The idea is read the full URL (domain + subdirectory)
and replace "/" by "-" to convert it to a valid name for spip.

For example

I replace
$site = str_replace('www.', '', $_SERVER['HTTP_HOST']);

by

$site = str_replace('www.', '', $_SERVER['SCRIPT_URI']);
$site = str_replace('http://', '', $site);
$site = substr($site, 0, -1);
$site = str_replace('/', '-', $site);

If I call it from http://nqnwebs.com/newsite by default mutualization
try to create 'sites/nqnwebs.com' but with this hack it's
'sites/nqnwebs.com-newsite' that it's a valid directory.

The problem, of course, is then it fail with redirectioning.

On 04/03/2009, at 5:00 AM, Renato Formato wrote:

Maybe what you need is to configure apache to point all of your
myspip.com/spip1
myspip.com/spip2
myspip.com/anotherspip
to the spip root folder with some aliases:

Alias /spip1 /var/www/spip
Alias /spip2 /var/www/spip
Alias /anotherspip /var/www/spip

Could you use rewrite rules (so that you don't need to edit the configuration and restart every new site)? Changing this (from .htaccess in 2.0.3):

  RewriteRule ^[^\.]+(\.html)?$ spip.php?page=type_urls [QSA,E=url_propre:$0,L]

to this (assumes that *all* sites are in subdirectories):

  RewriteRule ^[^/]+/([^\.]+(\.html)?)$ spip.php?page=type_urls [QSA,E=url_propre:$1,L]

will do something similar, but might also confuse SPIP about the subdirectory, so it may not work.

Another alternative (again, avoiding the need to restart Apache every time you add a site) is to use AliasMatch. Assuming that *all* subdirectories are SPIP sites and that SPIP is in /var/www/spip:

  AliasMatch ^/[^/]+(.*) /var/www/spip

Regards,

Thomas Sutton

Web Developer
bouncingorange
graphic + web design