When you are trying to build big OJS site (20 or more magazines), the first technical dilemma to solve is if you are going to go with ONE or MULTIPLE OJS installations.
There is a nice post that explains how to proceed with ONE single multi-magazine installation: Individual Domain Name for Each Journal within ONE OJS inst. but I didn't see much information about how to address a multi-ojs secneario, so this post it's done to report my advances for those that arrive to this point now as well as discuss and learn from those that walk this way before me.
Although the discussion about "why multiple-OJS instead of one-OJS" is really interesting (and I love to read more about it), this post didn't focuses in it and just reports and open discussion about how to implement the multi-OJSs proposal.
This is what I'm trying to accomplish:
- Code: Select all
http://example.com
http://example.com/ojs1
---------------- http://example.com/magazine1
| | -----------------
| | | | ---------------
| |-------------> | OJS 1 | -------------> | Magazine 1 |
| | | | ---------------
| CMS | -----------------
| | ----------------- http://magazineN.foo.net
| | | | ---------------
| |-------------> | OJS n | -------------> | Magazine n |
| | | | ---------------
| | -----------------
----------------
In the root directory we will place a CMS (a drupal) to publish news and a list of all the magazines included in the system.
Each OJS subfolder will be a physical directory with symbolic links to a "base" ojs.
Not everything will be "symlinked": index.php, config.inc.php and cache will be different for each OJS installation.
A few extra folders (webdata) will be also specific for each OJS: files, public and registry.
An .htaccess (in root folder) or vhost will do the redirection work.
Basic maintenance (ojs creation, delete, backup) could be easily accomplished with an script (I attach to this post my first release).
This script generates all the structure of a new OJS, and fills the database with a "preconfigurated basic OJS".
The script plays with string-replacement (sed) to substitute some tags with the appropriate information in config.inc.php, database dumps and so on.
This is the general folder structure as is thought now:
- Code: Select all
/home/webuser
|__ backup
|__ logs
|__ scripts
|__ htdocs
| |__ (a few CMS files and folders)
| |__ ojs1
| | |__ index.php
| | |__ config.inc.php
| | |__ cache
| | |__ (the rest of ojs folders are linked to: /home/webuser/ojs/versions/current/*)
| |__ ojs2
| |__ index.php
| |__ config.inc.php
| |__ cache
| |__ (the rest of ojs folders are linked to: /home/webuser/ojs/versions/current/*)
|__ ojs
|__ versions
| |__ current (-> ojs2.3.4)
| |__ ojs-2.3.4
| |__ ojs-2.3.3
|__ templates
| |__ baseMagazineDump.sql
| |__ createDB.sql
| |__ deleteDB.sql
| |__ config.inc.php.base
|__ webdata
|__ ojs1
| |__ files
| |__ public
| |__ registry
|__ ojs2
|__ files
|__ public
|__ registry
As you will appreciate, this structure is flexible enough to allow sites with specific themes or plugins, but rigid enough to facilitate the administration.
Right now, the script is working fine (will be translated to English and released soon) but as I announced in the first diagram, I want "clean urls" (RESTful ones) so more job need to be done.
First at all, we need to configure our OJS to build the URLs as we like.
It means that each OJS config.inc.php need to define some variables as:
* base_url = "http://redi-test.uab.cat/ojs-test03"
* base_url[index] = http://example.com/ojs1
* base_url[magazine1] = http://redi-test.uab.cat/magazine1
* restful_urls = On
After this, OJS is ready, but Apache didn't so .htaccess or vhost need to be modified to do the redirection work.
If I understood former posts (this or that), those are the basic redirections that need to be done:
* The magazines: http://example.com/magazine1 --> http://example.com/ojsN/index.php/magazineN/*
* The ojss: http://example.com/ojs1 --> http://example.com/ojsN/index.php/index/*
More complex ones -for instance with external domains or with slash fixing- would be nice, but right now let's go with the KISS solution.
So translated to "mod_rewrite" syntax this is what I thought that need to be included in the vhost or .htaccess in the main root web folder (/home/webuser/htdocs):
- Code: Select all
RewriteEngine On
RewriteBase /
RewriteRule ^magazine1$ magazine1/
RewriteRule ^magazine1/(.*)$ ojs1/index.php/magazine1/$1 [L]
RewriteRule ^ojs1$ ojs1/
RewriteRule ^ojs1/(.*)$ ojs1/index.php/index/$1 [L]
Here is where I'm sucked: Although magazine navigation is working fine, I'm unable to login or register any user.
Instead of login, page is redirected to: http://example.com/magazine1/login?sour ... ne1%2Fuser
So I suspect my rules aren't well configured but after tones of testing I can't manage to make them work.
Any body had similar experiences? Any clue about how to fix it? Any suggestion to the multi-OJS proposal.
Thanks a lot for your help,
m.
PD: This post will be rewritten as a manual as soon as I fix this final point and I finish the script.
