[opencms-dev] mod_proxy setup problems

Shi Yusen shiys at langhua.cn
Mon Jun 2 21:18:11 CEST 2008


If you use Apache 2.2.x, you can try the new ajp in mod_proxy.
http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

Here is a sample config of www.langhua.cn, the logic behind is quite
simple:
If a uri should be proxied, then proxy it. If not, use apache.
If a uri should be prefixed with /opencms/opencms/, then add it.
If a uri should be handled by OpenCms 404 handler, then use it.
...

NameVirtualHost *:80

<VirtualHost *:80>
        ServerAdmin shijh at langhua.cn
        DocumentRoot /usr/share/tomcat5/webapps/opencms
        ServerName www.langhua.cn

        RewriteEngine on

        # The URIs don't need to proxy
        RewriteCond %{REQUEST_URI} !^/opencms/resources/.*$
        RewriteCond %{REQUEST_URI} !^/export/.*$
        RewriteCond %{REQUEST_URI} !^/forum/.*$
        RewriteRule !^/opencms/opencms/.*$ /opencms/opencms
%{REQUEST_URI} [PT]

        # Keep OpenCms handle404 function work in the integration
        RewriteCond %{REQUEST_URI} ^/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 /${WEBAPP_NAME}/resources, delete
the /${WEBAPP_NAME} prefix
        RewriteCond %{REQUEST_URI} ^/opencms/resources/.*$
        RewriteRule ^/opencms/(.*)$ /$1 [PT]

        ProxyRequests Off 
        ProxyPreserveHost On
        ProxyPass /opencms/opencms balancer://cluster/
stickysession=jsessionid 
        <Proxy balancer://cluster/> 
                BalancerMember ajp://127.0.0.1:8009/opencms/opencms
        </Proxy> 

        # Multiple proxies
        ProxyPass /forum balancer://forumcluster/
stickysession=jsessionid 
        <Proxy balancer://forumcluster/> 
                BalancerMember ajp://127.0.0.1:8009/forum
        </Proxy> 

</VirtualHost>

You can also add Location and other configs in the VirtualHost.

Tomcat server.xml config:
<Connector port="8009" emptySessionPath="true" URIEncoding="UTF-8" 
   enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />

OpenCms opencms-importexport.xml config:
			<rfs-prefix>/export</rfs-prefix>
			<vfs-prefix></vfs-prefix>

Regards,

Shi Yusen/Beijing Langhua Ltd.


在 2008-06-02一的 13:43 -0400,Brad Clemmons Jr写道:
> Hi all,
> I'm having a few problems on a quasi-new install.  I already have one
> system running Opencms 5 and I had the current system running
> opencms7.0.4 basically in standalone mode.   The problems started when
> I tried to setup for mod_proxy.
> 
> I tried setting up via mod_proxy via the instructions for using
> mod_proxy in the 7.0.4 documentation module.  I already had a working
> Opencms install so I wasn't real happy about the instructions provided
> under "using mod_proxy" regarding removing /ROOT and making sure there
> were no opencms installs already under webapps.  But I digress.
> 
> This is what my tomcat_home/webapps looks like after removing the
> original /ROOT and /opencms directories, renaming the original
> opencms.war to ROOT.war and dumping the ROOT.war in there and letting
> tomcat extract it.
> drwxr-xr-x 10 tomcat tomcat     4096 Jun  2 11:31 .
> drwxr-xr-x 11 tomcat tomcat     4096 Jan 28 13:41 ..
> drwxr-xr-x  5 tomcat tomcat     4096 Jan 28 13:38 balancer
> drwxr-xr-x 21 tomcat tomcat     4096 Jan 28 13:38 jsp-examples
> drwxr-xr-x  3 tomcat tomcat     4096 Jun  2 11:31 opencms
> -rw-r--r--  1 tomcat tomcat        0 Jun  2 11:31 opencms_init.log
> drwxr-xr-x  7 tomcat tomcat     4096 Jun  2 12:20 ROOT
> -rw-r--r--  1 root   root   46442274 Mar  3 16:23 ROOT.war
> drwxr-xr-x  4 tomcat tomcat     4096 Jan 28 13:38 servlets-examples
> drwxr-xr-x 12 tomcat tomcat     4096 Jan 28 13:39 tomcat-docs
> drwxr-xr-x  3 tomcat tomcat     4096 Jan 28 13:38 webdav
> 
> 
> I followed the instructions for "Using mod_proxy" for Opencms 7.0.4
> 
> This is the error after setup successfully completes and it tries to
> load the default page:
> # HTTP Status 404 - /opencms/index.jsp
> # type Status report
> # message /opencms/index.jsp
> # description The requested resource (/opencms/index.jsp) is not available.
> # Apache Tomcat/5.5.26
> 
> Restarting tomcat had no affect.
> 
> I continued on through Step 4(Using mod_proxy) anyway and when
> attempting to access the site at http://server.mydomain.com/ I get
> this error:
> # HTTP Status 404 - /opencms/
> # type Status report
> # message /opencms/
> # description The requested resource (/opencms/) is not available.
> # Apache Tomcat/5.5.26
> 
> If I try to manually type in the index page which I would figure would
> be servername.mydomain.com/ROOT/index.jsp I get a similar error
> basically not finding the page.
> 
> What am I missing here?  I made backups of my working install before
> mucking with this mod_proxy stuff so worst comes to worst I can say to
> **** with it and roll back.  I'd like to get this working though for a
> number of reasons.
> 
> What the server is running on:
> CentOS 5
> Apache2.2
> Tomcat5.5
> Java SDK 6update6
> Opencms7.0.4
> 
> 
> Thanks,
> 
> -Brad
> 
> 
> 
> 




More information about the opencms-dev mailing list