Install opencms as ROOT with a very simple configuration of Apache and mod jk

From OpenCms Wiki
Jump to: navigation, search

Very simple, but the offline-project doesn't work with this.

Install opencms as ROOT with a very simple configuration of Apache (still works with OpenCms 7.05, Apache 2.2.9 and Tomcat 6). based on this.

In the following exchange ${tomcat_home} for your tomcat-directory.

Rename opencms.war to ROOT.war, copy it to your ${tomcat_home}/webapps and restart tomcat. Install opencms.

After install:

For the Apache (for each of your sites):

<VirtualHost *:80>
    	ServerName www.myWebSite.com
    	DocumentRoot "${tomcat_home}/webapps/ROOT"    
 
	<Directory "${tomcat_home}/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>

server.xml:

<Server port="8105" shutdown="SHUTDOWN">
    <Service name="myWebSite">
	 <Connector emptySessionPath="true"
           enableLookups="false" protocol="AJP/1.3"
            port="8009" minProcessors="5" maxProcessors="75"
            acceptCount="10" debug="0"/>
 
        <Valve className="org.apache.catalina.valves.AccessLogValve"
          directory="logs"  prefix="localhost_access_log." suffix=".txt"
          pattern="common"/>
 
        <Connector port="8080" address="127.0.0.1"/>
 
	<Engine name="Catalina" defaultHost="myWebSite">
            <Host name="myWebSite" appBase="${tomcat_home}/webapps"/>
        </Engine>
    </Service>
</Server>

In ${tomcat_home}/webapps/ROOT/WEB-INF/config/opencms-importexport.xml in remove the opencms-String (webapp-name, servlet-name) so that it looks like this.

	<rfs-prefix>/export</rfs-prefix>
       <vfs-prefix></vfs-prefix>


APPENDIX

Instead of installing as ROOT you may try making the folling changes after installing (as seen here. Edit webapps/opencms/WEB-INF/web.xml Modify the following record to let OpenCms know it's running as a root app. It will remove the first "opencms" from all links and referenced documents in displayed web pages (like stylesheets).

    <context-param>
        <param-name>DefaultWebApplication</param-name>
        <param-value>opencms</param-value>
    </context-param>

Note: Do NOT use the "WebApplicationContext" record when running as root, OpenCms workplace would fail miserably. (WebApplicationContext would be used if you specified some other path in conf/Catalina/localhost/opencms.xml, e.g. path="cms")

(feedback welcome on the discussion page)

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox