[opencms-dev] Help to hide /opencms/opencms using mod_jkandmod_rewrite in Apache

Robert Burén robert.buren at gmail.com
Thu Dec 2 11:44:57 CET 2004


The next step would be to configure Apache to work as a "reverse
proxy". Your browser will make all requests to Apache, which will
forward the requests to Tomcat, with a slightly different URL.

First, two changes in Tomcat: you need to change the url_prefix_http
again, to the empty string. Like this (in
WEB-INF/config/opencms.properties):
url_prefix_http=

You also need to tell Tomcat that it'll be running behind a reverse
proxy. You do that in tomcat's server.xml. Find the element similar to
this:
    <Connector port="8080"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               debug="0" connectionTimeout="20000"
               disableUploadTimeout="true">

 Now, add two more attributes in this tag, proxyName and proxyPort, like this:

    <Connector port="8080"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               debug="0" connectionTimeout="20000"
               disableUploadTimeout="true"
               proxyName="www.example.com" proxyPort="80" />

where "www.example.com" is the URL you will be using to access the
opencms site.

Finally, the next step is to tell Apache to act as a reverse proxy. I
use Apache 1.3.x, but I think it's the same in Apache 2. In the config
file (httpd.conf) add the following:

<VirtualHost 198.162.14.11>
ServerName www.example.com
UseCanonicalName off
NoCache *
ProxyPass /opencms/ http://www.example.com:8080/opencms/
ProxyPass /resources/ http://www.example.com:8080/resources/
ProxyPass /export/ http://www.example.com:8080/export/
ProxyPass / http://www.example.com:8080/opencms/
ProxyPassReverse / http://www.example.com:8080/opencms/
</VirtualHost>

Of course, you need to change the IP address and the "www.example.com"
to match your server. What this configuration does is to proxy all
calls to www.example.com on port 80 (the default web port) to
www.example.com port 8080. For all requests that begin with
"/opencms", "/resources" or "/export", the request will got to the
same path on the Tomcat server. For all other requests, a "/opencms"
will be added (as a prefix) to all requests on Tomcat.

Restart Tomcat and Apache and you should be fine!

At least, the above works for me.

/Robert



On Thu, 2 Dec 2004 11:23:54 +0100, Rafael Diaz Valdes
<rafael.diaz.valdes at cern.ch> wrote:
> Hello Arash,
> 
>  Thanks a Lot  for your help :-))
>  I installed Opencms as ROOT in Tomcat . I  renamed "opencms.war" to "ROOT.war" and deployed the application. So far everything went fine. Also I opened the WEB-INF/config/opencms.properties file and changed:
>  url_prefix_http=/${WEB_APP_NAME}/opencms
> to
> url_prefix_http=/opencms
> 
> After completing this step I accessed the aplication with the url
>    http://mydomain.com:8080/opencms/system/login/ without problem also I can see the the Opencms introduction page using this path http://mydomain.com:8080/opencms/  but how can I delete this /opencms/ to see the root of the VFS ???
> Using http://mydomain.com:8080/  alone I get the following page:
> 
> Directory Listing For /
> 
>   _____
> 
> Filename         Size    Last Modified
>    export/               Thu, 02 Dec 2004 09:25:14 GMT
>    ocsetup/              Thu, 02 Dec 2004 09:25:14 GMT
>    resources/            Thu, 02 Dec 2004 09:28:20 GMT
>   _____
> 
> Apache Tomcat/4.1.29
> 
>  Can you help me??
>  Best regards Rafael
> 
> 
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
> 
>



More information about the opencms-dev mailing list