[opencms-dev] mod_jk with multisite and without /opencms/opencms, as ROOT webapp (or not)

Bernd Wolfsegger bw at code-create.com
Fri Oct 21 18:09:20 CEST 2005


Hi,

I used the normal coyote connector and mod_proxy until now.
But had always massive problems getting all the connectors started properly ...

Just switched to mod_jk. (Apache 2.0.53-9.2, Tomcat 5.0.30-4, MySql 4.1.10a-3.2)
And found a very simple rewrite rule, which works perfectly.
The other stuff I saw is to complex for me :)

These are the files to change (just the relevant parts shown, in addition to the defaults).
First do a normal install with the apache / tomcat conf below.
After that change opencms directory and opencms.war below webapps to ROOT and ROOT.war
Don't forget to switch off the server in between :)
Adjust the opencms config files as shown below, and start again.

I think this should work also as no ROOT app, if you adjust the Rewrite and opencms config files properly.
I have not tested it though.


For the Apache (for each of your sites):

<VirtualHost 192.168.0.50:80>
    	ServerName www.server.com
    	DocumentRoot "/srv/www/tomcat/webapps/ROOT"    

	<Directory "/srv/www/tomcat/webapps/ROOT">
    		AllowOverride All
		Order allow,deny
    		Allow from all
	</Directory>

	RewriteEngine on
	RewriteRule ^/resources/(.*)$ - [PT]
	RewriteRule ^/export/(.*)$ - [PT]
	RewriteRule !^/opencms/(.*)$ /opencms%{REQUEST_URI} [PT]

        JkMount /* 			ajp13
        JkMount /opencms/*        ajp13
        JkMount /export/*     	ajp13
        JkMount /resources/*     	ajp13
</VirtualHost>



Inside server.xml

AJP/13 Connector enabled and:

<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
          <Manager className="org.apache.catalina.session.StandardManager" pathname="">
          </Manager>
</Host>



Inside opencms-system.xml

Just add as much sites as you need and provide for each a VHost as above.
And don't forget one for your workplace server.



Inside opencms-importexport.xml

		<rendersettings>
			<rfs-prefix>/export</rfs-prefix>
			<vfs-prefix></vfs-prefix>
			<userelativelinks>false</userelativelinks>			
			<exporturl>http://www.workplaceserver.com/handle404</exporturl>
			.
			.
			.
			.
			.


Thats all folks. Works also fine with https.
Paths /resources/ and /export/ are handled as if you would access OpenCms directly with Tomcat.

Kind regards, Bernd

-- 

[  Code Create
[  Web Content Management and Presentation


[  Bernd Wolfsegger
[  Sun Certified Programmer for Java(TM) 2 Platform


[  Lohmeyerstrasse 13
[  10587 Berlin
[  Germany
[  Fon +49 (0)30 26555788
[  Fax +49 (0)30 2651835
[  Mobile +49 (0)163 6505622

[  bw at code-create.com
[  http://www.code-create.com/




More information about the opencms-dev mailing list