[opencms-dev] CMS install in subdirectory

Andrew Myers amyers.work at optusnet.com.au
Thu Mar 27 06:52:23 CET 2008


Hi,

I'm setting up an intranet site using opencms with a view to getting to 
know opencms and using it on a public site down the track.

Because the server I am using already has some stuff on it (eg. 
http://myserver/wiki, http://myserver/jtrac, etc), I was unable to 
install opencms at the website root, and require it to be at a URL 
similar to the following:

http://myserver/intranet

I would also like to remove the "/opencms/opencms" from the URL as per 
this document:

http://www.opencms-forum.de/opencms-forum/viewthread?thread=713

I have attempted to modify the configuration so that it works with 
http://myserver/intranet, however I'm running into some problems. 

My apache config is as follows:

<VirtualHost *:80>
    ServerAdmin webmaster at localhost
    #DocumentRoot C:/wamp/www
    ServerName myserver

    # If the requested URI is not for the intranet at all, do not 
forward the request
    #SetEnvIfNoCase Request_URI !^/intranet/.*$ no-jk   
   
    # If the requested URI is located in the resources folder, do not 
forward the request
    SetEnvIfNoCase Request_URI ^/intranet/opencms/resources/.*$ no-jk


    # If the requested URI is static content do not forward the request
    SetEnvIfNoCase Request_URI ^/intranet/export/.*$ no-jk
   
    RewriteEngine on
    # If the requested URI is NOT located in the resources folder.
    # Prepend an /opencms/opencms to everything that does not already 
starts with it
    # and force the result to be handled by the next URI-handler ([PT]) 
(JkMount in this case)
   
    #AM - If the URL starts with intranet, and is NOT located in the 
resources folder,
    #replace intranet with /opencms/opencms
   
    RewriteCond %{REQUEST_URI} ^/intranet/.*$
    RewriteCond %{REQUEST_URI} !^/intranet/opencms/resources/.*$
    RewriteCond %{REQUEST_URI} !^/intranet/export/.*$
    #RewriteRule ^(/intranet/)(.*)$ /opencms/opencms/$2 [PT]
    RewriteRule ^(/intranet/)(.*)$ /opencms/opencms/$2 [PT]

    #AM - If the URL is exactly /intranet with no trailing slash
    RewriteCond %{REQUEST_URI} ^/intranet$
    RewriteRule ^/intranet$ /opencms/opencms/ [PT]

    # These are the settings for static export. If the requested 
resource is not already
    # statically exported create a new request to the opencms404 
handler. This has to be
    # a new request, because the current would net get through mod_jk 
because of the "no-jk" var.
    RewriteCond %{REQUEST_URI} ^/intranet/export/.*$
    RewriteCond "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}" !-f
    RewriteCond "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}/index_export.html" !-f
    RewriteRule .* 
/opencms/opencms/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [R]


    # If the request starts with /opencms/resources, delete the /opencms 
prefix
    RewriteCond %{REQUEST_URI} ^/opencms/resources/.*$
    RewriteRule ^/opencms/(.*)$ /$1


    DocumentRoot "C:/wamp/www"
   
    <Directory "C:/apache-tomcat-5.5.25/webapps/opencms/export">
        Order Deny,Allow
        Deny from all
        Allow from 127.0.0.1
    </Directory>   

    <Directory "C:/apache-tomcat-5.5.25/webapps/opencms/resources">
        Order Deny,Allow
        Deny from all
        Allow from 127.0.0.1
    </Directory>   
   
    JkMount /opencms* worker1
    JkMount /jtrac* worker1
   
</VirtualHost>

The relevant part of the various files are as follows:

tomcat/conf/server.xml

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" emptySessionPath="true"
               enableLookups="false" redirectPort="8443" 
protocol="AJP/1.3" />

opencms-system.xml

    <sites>
      <workplace-server>http://myserver</workplace-server>
      <default-uri>/sites/HRV_Intranet/</default-uri>
      <site server="http://myserver" uri="/sites/HRV_Intranet/"/>
    </sites>

opencms-importexport.xml

<rfs-prefix>${CONTEXT_NAME}/export</rfs-prefix>
<vfs-prefix>${CONTEXT_NAME}${SERVLET_NAME}</vfs-prefix>

I have tried a number of different settings for the above but these ones 
are the only ones that don't give errors in the admin area.  
Unfortunately they mean all mylinks still contain "/opencms/opencms"

If I set them like this:

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

I get the following error when I save a page in the editor:

javax.servlet.jsp.JspException: File not found: 
/intranet/system/workplace/views/explorer/explorer_files.jsp

javax.servlet.ServletException: javax.servlet.jsp.JspException: File not found: /intranet/system/workplace/views/explorer/explorer_files.jsp
	at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:837)
	at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
	at org.apache.jsp.WEB_002dINF.jsp.offline.system.workplace.commons.publishresource_jsp._jspService(publishresource_jsp.java:211)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)
	at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:594)
	at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:505)
	at org.opencms.flex.CmsFlexRequestDispatcher.includeExternal(CmsFlexRequestDispatcher.java:194)
	at org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:170)
	at org.opencms.loader.CmsJspLoader.service(CmsJspLoader.java:433)
	at org.opencms.flex.CmsFlexRequestDispatcher.includeInternalWithCache(CmsFlexRequestDispatcher.java:423)
	at org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:174)
	at org.opencms.loader.CmsJspLoader.dispatchJsp(CmsJspLoader.java:467)
	at org.opencms.loader.CmsJspLoader.load(CmsJspLoader.java:412)
	at org.opencms.loader.CmsResourceManager.loadResource(CmsResourceManager.java:730)
	at org.opencms.main.OpenCmsCore.showResource(OpenCmsCore.java:1349)
	at org.opencms.main.OpenCmsServlet.doGet(OpenCmsServlet.java:151)
	at org.opencms.main.OpenCmsServlet.doPost(OpenCmsServlet.java:163)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
	at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:200)
	at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
	at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:773)
	at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
	at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:895)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
	at java.lang.Thread.run(Thread.java:595)


I have also had reported that some of the links to system resources come 
up incorrectly with the word "intranet" repeated, eg:

http://myserver/intranet/intranet/intranet/Human_Resources/Forms/Docs/Weekly_Casual_Timesheets.doc 
<http://planet-hrv/intranet/intranet/intranet/Human_Resources/Forms/Docs/Weekly_Casual_Timesheets.doc>

I will be the first to admin that I have a poor understanding of the 
rewrite rules, but there is no documentation I can find for a setup in a 
subdirectory, removing the /opencms/opencms

Can anyone offer any advice on what I might be doing wrong and how I 
might be able to get around these issues?

Many thanks in advance.

Andrew.




More information about the opencms-dev mailing list