[opencms-dev] Configuring OPENCMS on apache front server and tomact as backend.

Paul-Inge Flakstad flakstad at npolar.no
Tue Nov 4 12:41:43 CET 2014


Hi,

For what it's worth, here is the setup routine I use - works every time. (Other routines are described on the OpenCms Wiki and elsewhere, and may be better. However, they also tend to be more complex.)

Note: The how-to assumes a Linux box with the OpenCms webapp home at {TOMCAT_HOME}/webapps/opencms/.

Step 1. Configure OpenCms

Add your site to the OpenCms configuration file opencms-system.xml:

<sites>
  <workplace-server>http://www.mysite.org</workplace-server>
  <default-uri>/sites/default/</default-uri>
  <shared-folder>/shared/</shared-folder>
  <site server="http://www.mysite.org" uri="/sites/default/"/>
</sites>

Note: Configuring a dedicated domain name (e.g. cms.mysite.org) for the workplace is recommended, but not done here.

Open the OpenCms configuration file opencms-importexport.xml and find the staticexport->rendersettings node.

Inside the rendersettings node, change this line:

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

to this:

<vfs-prefix></vfs-prefix>

Save the file.

Step 2. Configure Tomcat

We need to define a connector in Tomcat's configuration. Open the Tomcat configuration file server.xml, and make sure the following connector is defined:

<Connector port="8009" emptySessionPath="true" enableLookups="false" protocol="AJP/1.3" />

Save the file and restart Tomcat.

Step 3. Configure Apache

Open Apache's main configuration file, httpd.conf:

Apache must load the required modules, so first check and add/uncomment these directives, if necessary:

LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so

With those in place, all that remains is defining a virtual host. It is typically added at or near the bottom (modify all paths to fit your actual system):

<VirtualHost *:80>
  DocumentRoot "/usr/local/apache-tomcat-5.5.27/webapps/opencms/"
  ServerName www.mysite.org<http://www.mysite.org>

  <Proxy ajp://localhost:8009*>
    Allow from all
  </Proxy>

  ProxyPass        /opencms/   ajp://localhost:8009/opencms/
  ProxyPassReverse /opencms/   ajp://localhost:8009/opencms/

  ProxyPass        /           ajp://localhost:8009/opencms/opencms/
  ProxyPassReverse /           ajp://localhost:8009/opencms/opencms/
</VirtualHost>

Save the file and restart Apache.

That's it, you're done! You should now be able to access your site at www.mysite.org<http://www.mysite.org> and the workplace login at www.mysite.org/system/login<http://www.mysite.org/system/login>.

Cheers,
Paul

From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Manoj.Sharma at nevagroup.com
Sent: 3. november 2014 06:06
To: opencms-dev at opencms.org
Subject: [opencms-dev] Configuring OPENCMS on apache front server and tomact as backend.

Hi All,
            I have a website which in develop in OponCms 9.x, i have configure that website on apache as front server and tomcat as backend. the website working perfectly but the issue is when i perform redirect operation on site like when user submit feedback and then i redirect user to another thank you page or logout from site then website URL will get modified as IP address and (:) colon removed from the URL and website no longer available. I'll get the the message in browser "The web page is not available."  Example :

I enter URL in google chrom as mywebsite.com and login into the website as admin, then i logout from site then the url change to http// 123.11.23.23/system/login not to mywebsite.com/system/login.

i am not able to under stand why this is happing, it just a issue in redirect whenever redirect operation perform then url will modify automatically. I am sure there is something that i ahve missed in configuration, but question i what ?  i am putting my configuration that i have done on server please look into and let me know the issue.

opencms-system.xml

        <sites>
            <workplace-server>http://www.mywebsite.in<http://www.mywebsite.in/></workplace-server>
            <default-uri>/sites/default/</default-uri>
            <shared-folder>/shared/</shared-folder>
            <site server="http://www.mywebsite.in<http://www.mywebsite.in/>" uri="/sites/default/" title="" position="3.4028235E38" webserver="true"/>
        </sites>

opencms-importexport.xml
              <rendersettings>
                        <rfs-prefix>${CONTEXT_NAME}/export</rfs-prefix>
                        <vfs-prefix>${CONTEXT_NAME}</vfs-prefix>
                        <userelativelinks>false</userelativelinks>
                        <exporturl>http://127.0.0.1:8080$<http://127.0.0.1:8080$/>{CONTEXT_NAME}/handle404</exporturl>
                        <plainoptimization>true</plainoptimization>
                        <testresource uri="/system/shared/page.dtd" />
                        <resourcestorender>
                                <regex>/sites/.*</regex>
                                <regex>/system/workplace/commons/style/.*</regex>
                                <regex>/system/galleries/.*</regex>
                                <regex>/system/modules/.*/resources/.*</regex>
                        </resourcestorender>
                </rendersettings>
server.xml
<?xml version="1.0" encoding="utf-8"?>
<Server port="8005" shutdown="SHUTDOWN" debug="0">
  <Service name="Tomcat-Standalone">
    <!-- Define a connector for the "public visible" server name -->
    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8080" minProcessors="5" maxProcessors="75" proxyName="http://123.114.23.42<http://123.114.23.42/>" proxyPort="80" useBodyEncodingForURI="true" enableLookups="true" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000" useURIValidationHack="false" disableUploadTimeout="true"/>
    <Engine name="Standalone" defaultHost="localhost" debug="0">
      <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true">
        <!-- You can change "unpackWARs" and "autoDeploy" to false after the installation is finished -->
        <Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true"/>
      </Host>
    </Engine>
  </Service>
  <Service debug="0" name="PSA">
    <Connector port="9008" enableLookups="true" protocol="AJP/1.3"/>
    <Connector port="9080" maxThreads="15" minSpareThreads="5" maxSpareThreads="75" enableLookups="true" acceptCount="10" connectionTimeout="20000" disableUploadTimeout="true"/>
    <Engine name="PSA" defaultHost="localhost"/>
  </Service>
</Server>


httpd.conf

#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#

LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_alias_module modules/mod_authn_alias.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule ldap_module modules/mod_ldap.so
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule expires_module modules/mod_expires.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule info_module modules/mod_info.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule cache_module modules/mod_cache.so
LoadModule suexec_module modules/mod_suexec.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule version_module modules/mod_version.so

.....  some more comments and configurations there then

<VirtualHost *:80>
    <Directory "${TOMCAT_HOME}/webapps/ROOT/">
        Order allow,deny
        Allow from all
    </Directory>
    ServerName ${DOMAIN_NAME}
    ServerAdmin webmaster at alkacon.com<mailto:webmaster at alkacon.com>
    DocumentRoot "/usr/share/tomcat6/webapps/ROOT/"
    ErrorLog logs/error.log

    # Log only non-redirect requests in "normal" log file
    SetEnvIf Request_URI "\/opencms\/*" redirect
    CustomLog logs/localhost-access.log common env=!redirect

    ProxyPass  /opencms/  !
    RedirectPermanent /opencms/  http://$<http://$/>{DOMAIN_NAME}/

    ProxyPass         /resources/               !
    ProxyPass         /export/                  !

    ProxyPass         /                         http://localhost:8080/opencms/
    ProxyPassReverse  /                         http://localhost:8080/opencms/

</VirtualHost>

<VirtualHost *:8080>
    <Directory "${TOMCAT_HOME}/webapps/test/">
        Order allow,deny
        Allow from all
    </Directory>
    ServerName ${DOMAIN_NAME}
    ServerAdmin webmaster at alkacon.com<mailto:webmaster at alkacon.com>
    DocumentRoot "${TOMCAT_HOME}/webapps/wewebsite/"
    ErrorLog logs/error.log

    # Log only non-redirect requests in "normal" log file
    SetEnvIf Request_URI "\/wewebsite\/*" redirect
    CustomLog logs/localhost-access.log common env=!redirect

    ProxyPass         /wewebsite/                 !
    RedirectPermanent /wewebsite/                http://$<http://$/>{DOMAIN_NAME}/


    #ProxyPass         /                         http://localhost:8080/wewebsite/
    #ProxyPassReverse  /                         http://localhost:8080/wewebsite/
</VirtualHost>


i have fond these configuration from http://www.opencms-wiki.org/wiki/Avoiding_/opencms/opencms_in_the_URL_(apache_%2B_mod_proxy)

Please friends help me. and thanks paul for your last reply to my question.

Manoj Kumar Sharma
9718729491
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20141104/6c3ccbe9/attachment.htm>


More information about the opencms-dev mailing list