Adding new sites or domains to an OpenCms installation used to be a tedious task that required editing the OpenCms XML configuration as well as configuring the webserver to recognize the new site URL.
OpenCms 9 features the new site manager tool, which allows Administrators to create new and manage existing sites with a simple GUI based interface. This new tool will automatically update the OpenCms configuration as well as the webserver configuration, without the need to restart OpenCms.
In this workshop session, Rüdiger will start with a default OpenCms installation and use the site manager to remove the /opencms/opencms path prefix from the URL. He will then add some new sites and domains to the server configuration. He will also explain how to adopt the standard scripts shipped with the site manager for other webserver configurations.
4. ● One OpenCms installation can be used to
maintain multiple websites
● Every site has its own set of resources and
can be addressed with an URL by the public
● Optional server aliases and a secure server
(https) can be configured for each site
● This information is stored in the OpenCms XML
configuration (opencms-system.xml)
4
Sites in OpenCms
5. ● To add new or to manage existing sites
administrative server knowledge and
permissions were required
● Edit the OpenCms XML configuration
● Configure the Web-Server’s files manually
● Restart the servlet container
● The simple Site Manager’s UI helps to
decrease the configuration complexity
5
Requirements of former days
8. ● OpenCms requires a specific Apache
configuration to
● Access a site with a nice web address
● Get rid of /opencms/opencms in the URL
● Serve static resources directly by Apache
● Configure the Web-Server is as well as editing
the OpenCms configuration a painstaking task
● Therefore OpenCms 9 supports generating
Web-Server configurations on-the-fly
8
Integrate Apache in front
9. ● Prepare Apache Web-Server
● mod_proxy, mod_proxy_http, mod_rewrite and mod_jk
● Include a directory where for the virtual host files
● Create ONE virtual “by hand” for the OpenCms
workplace server
● Prepare Apache Tomcat
● Enable AJP connector and set session cookie path to
“/”, if OpenCms is not running as ROOT
● Prepare OpenCms (opencms-importexport.xml)
and replace the RFS and the VFS prefixes with
9
Environment preparation
<rfs-prefix>/export</rfs-prefix>
<vfs-prefix></vfs-prefix>
15. 15
String Template based generation
<VirtualHost *:80>
DocumentRoot "$DOCUMENT_ROOT$"
ServerName $SERVER_NAME_WITH_PORT$
$ALIAS_DIRECTIVE$ $SERVER_ALIASES$
[...]
</VirtualHost>
● By default the distribution contains an Apache
virtual host “String template” that is working
with OpenCms out of the box …
16. 16
String Template based generation
$CONFIG_FILENAME$
$LOGGING_DIRECTORY$
$WEBAPP_NAME$
$DOCUMENT_ROOT$
$CONTEXT_PATH$
$SERVLET_PATH$
$DEFAULT_ENCODING$
$SERVER_URL$
$SERVER_NAME_WITH_PORT$
$SERVER_PROTOCOL$
$SERVER_NAME$
$SERVER_ALIASES$
$SECURE_URL$
$SECURE_SERVER_NAME$
$SECURE_SRV_WITH_PORT$
$SECURE_SERVER_PORT$
$SECURE_SERVER_PROTOCOL$
$ALIAS_DIRECTIVE$
$SITE_TITLE$
$ERROR_PAGE$
● Such a template file can contain „macros“, that
will be replaced when executing the „Update
Web-Server“ action
17. ● Generated configuration files are written to a
specified location on the server's RFS
● As a very last step you can let the servlet
container execute a Shell-Script
17
String Template based generation
cp ~Web-Server.tmp
/etc/apache2/sites-enabled/happy.managers.org
** only added for illustration purposes (something equivalent is done in Java) **
#!/bin/bash
# simple script reloading the apache web server
/etc/init.d/apache2 reload
18. ● In a default OpenCms installation you'll find the
example files on the server at
<OPENCMS_HOME>/WEB-INF/server-scripts
18
String Template based generation
available-macros.txt (with explanation in it)
script.bat (Restarts the Apache on Windows)
script.sh (reloads /etc/init.d/apache2 on Unix)
vhost.template (for none secure sites)
vhost-secure.template (for secure sites)
worker.conf (example for mod_jk)
worker.properties (ajp13 config)
20. ● Administrators can now create new sites and
manage existing sites using a simple GUI
● Global settings like the workplace server, the
default URI or the shared folder location can be
selected using the new Admin-Tool
● Automated configuration update by OpenCms
● Generate Web-Server files 100% dynamically
… automatically run a script after generation
… and getting rid of /opencms/opencms/
… without deep knowledge about the Web-Server
● No servlet container restart required anymore
20
Today’s benefits