To run several sites with one Magnolia instance (author and public) you can use Apache with mod_jk (however, with Apache 2, the mod_proxy plug-in provides a more generic interface, suitable for Tomcat as well as any other application server). Here is what you have to do:

1. Give every site a separate content tree. I.e., create a top-level item in the "Websites" panel for each site you wish to create.

- /site1.html
- /site2.html
...

2. Configure Apache with mod_jk, setup mod_jk (/etc/httpd/httpd.conf):

# Load mod_jk
#
LoadModule jk_module /usr/lib/apache/mod_jk.so
# Configure mod_jk
#
JkWorkersFile /etc/httpd/conf/workers.properties
JkLogFile /var/log/httpd/mod_jk.log

3. Setup workers.properties for Magnolia (/etc/httpd/conf/workers.properties):

# Setting Java Home
workers.java_home=/usr/java/j2sdk1.4.2_03
ps=/
worker.list=author,public
worker.author.port=8019
worker.author.host=localhost
worker.author.type=ajp13

worker.public.port=8020
worker.public.host=localhost
worker.public.type=ajp13

4. Define virtual hosts for all of you sites (/etc/httpd/httpd.conf):

NameVirtualHost *

# Site1
<VirtualHost *>
ServerName www.site1.org
ServerAlias site1.org
RewriteEngine on
RewriteRule ^/$ /site1.html [R]
JkMount /* public
</VirtualHost>

# Site2
<VirtualHost *>
ServerName www.site2.org
ServerAlias site2.org
RewriteEngine on
RewriteRule ^/$ /site2.html [R]
JkMount /* public
</VirtualHost>

If needed you can use ProxyPass/Reverse directives instead of RewriteRule.

5. Define a virtual host for the authoring instance (/etc/httpd/httpd.conf):

<VirtualHost *>
DocumentRoot /srv/www/htdocs/site1
ServerName author.site1.org
ServerAlias author.site2.org
JkMount /* author
</VirtualHost>

6. Setup roles for each site like you find in Setup editor role for a site

7. Test it

Basically, this should be enough, but if you are making this on a Linux OS and SELinux is running you may experience permission problems during the redirect. In this case you'll find the following messages in the error.log of the Apache:

Permission Denied: Proxy: HTTP: Attempt to connect to http://192.168.26.128:81 failed

In this case, try to enabled script access in SELinux (Described for fedoracore):

Desktop -> System Setting -> Security level -> SElinux -> HTTPD Service -->
Check "Allow HTTPD scripts to connect to the network"

Once this is set up, you may find Getting site data helpful.

In its previous incarnation on JspWiki, this page was last edited on Feb 9, 2007 10:59:43 AM by Magnolia
Other known authors include :

  • RalfHirning