A normal local installation of OpenCms in a Tomcat container yields URLs like http://localhost:8080/opencms/opencms/welcome/ etc. If OpenCms is the only application on Tomcat, there’s no need for the first ‘opencms’. And if the second will be automatically filtered out, you can use OpenCms with URLs like this: http://localhost:8080/welcome/ .
There’s no need to use an additional Apache WebServer (httpd), just plain Tomcat and a Java class and some tricks.
- Before installation of OpenCms rename original opencms.war file to ROOT.war
- remove default ROOT folder in your $CATALINA_HOME/webapps (e.g. /usr/local/apache-tomcat-7.0.41/webapps)
- install MySQL server if needed
- start Tomcat (e.g. with /usr/local/apache-tomcat-7.0.41/bin/startup.sh )
- start OpenCms installation in your browser (localhost:8080/setup )
- next… next… finish (default values should be ok for your local installation)
- see welcome page (with one remaining ‘opencms’ in URL): http://localhost:8080/opencms/welcome/
- in web.xml (in ROOT/WEB-INF folder) add the following code:
<filter> <filter-name>UriRewriteFilter</filter-name> <filter-class>com.dcampus.opencms.web.UriRewriteFilter</filter-class> <init-param> <param-name>ignore-uri</param-name> <param-value>/opencms/,/resources/,/export/,/setup/,/update/,/webdav/,/opencms-errorhandler/</param-value> </init-param> <init-param> <param-name>prefix</param-name> <param-value>/opencms</param-value> </init-param> </filter> <filter-mapping> <filter-name>UriRewriteFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
- and alter in that same web.xml file the following line from
<context-param> <param-name>OpenCmsServlet</param-name> <param-value>/opencms/*</param-value> </context-param>
to
<context-param> <param-name>OpenCmsServlet</param-name> <param-value>/*</param-value> </context-param>
(‘/opencms’ removed)
- now download the UriRewriteFilter Java class into your home directory, compile it and deploy it to OpenCms as follows:
-
wget http://opencms.996256.n3.nabble.com/attachment/10246/0/UriRewriteFilter.java
-
javac -cp /usr/local/apache-tomcat-7.0.41/lib/servlet-api.jar UriRewriteFilter.java
-
mkdir -p /usr/local/apache-tomcat-7.0.41/webapps/ROOT/WEB-INF/classes/com/dcampus/opencms/web
-
cp UriRewriteFilter*.class /usr/local/apache-tomcat-7.0.41/webapps/ROOT/WEB-INF/classes/com/dcampus/opencms/web
-
- restart Tomcat
- go to URL-shortened welcome page: http://localhost:8080/welcome
Appendix:
http://lists.opencms.org/pipermail/opencms-dev/2011q3/035947.html
Your job at codecentric?
Jobs
Agile Developer und Consultant (w/d/m)
Alle Standorte
More articles in this subject area
Discover exciting further topics and let the codecentric world inspire you.
Gemeinsam bessere Projekte umsetzen.
Wir helfen deinem Unternehmen.
Du stehst vor einer großen IT-Herausforderung? Wir sorgen für eine maßgeschneiderte Unterstützung. Informiere dich jetzt.
Hilf uns, noch besser zu werden.
Wir sind immer auf der Suche nach neuen Talenten. Auch für dich ist die passende Stelle dabei.
Blog author
Andreas Christ
Do you still have questions? Just send me a message.
Do you still have questions? Just send me a message.