Search:

Apache » Lenya
project logo
  • Project
  • Developer
  • Community
  • Version 2.0
  • Version 1.2
  • Version 2.0
    • FAQs
    • Installation
      • Download
      • Subversion Access
      • Install Instructions
    • Tutorials
      • Create a Publication
      • Create a Resource Type
        • Declaration
        • Creation
        • Presentation
        • Editing (One-Form)
        • Editing (BXE)
      • Implement a Usecase
        • Prerequisites
        • The Usecase
      • Setting up Eclipse
      • Proxying
        • Proxying
        • mod_proxy
        • mod_proxy_ajp
      • Best Practises
      • Production Checklist
      • Writing Tests
    • Concepts
      • Publication
      • Working with Documents
      • Authoring and Live mode
      • WYSIWYG
    • Technical Reference
      • Overview of Lenya Sitemaps
      • Repository
      • Access Control Specification
      • Usecase Framework
        • Overview
        • AbstractUsecase
      • Publications
        • Configuration
        • Publication Templating
      • Resource Types
      • Modules
      • Meta data
      • Protocols
        • lenya Protocol
        • lenya-document Protocol
        • site Protocol
        • lenyadoc Protocol
        • fallback Protocol
      • URLs and Links
        • URL Mapping
        • Link Management
      • Clustering
    • Core API
    • Core Modules
      • ac
        • Overview
        • API
      • acusecases
        • Overview
        • API
      • administration
        • Overview
        • API
      • cache
        • Overview
        • API
      • janitor
        • Overview
        • API
      • ldap
        • Overview
        • API
      • linking
        • Overview
        • API
      • observation
        • Overview
        • API
      • properties
        • Overview
        • API
      • sitemanagement
        • Overview
        • API
      • templating
        • Overview
        • API
      • usecase
        • Overview
        • API
      • workflow
        • Overview
        • API
    • Standard Modules
      • blog
        • Overview
        • API
      • bxe
        • Overview
      • cforms
        • Overview
        • API
      • collection
        • Overview
        • API
      • contactform
        • Overview
        • API
      • development
        • Overview
        • API
      • editors
        • Overview
        • API
      • export
        • Overview
        • API
      • fckeditor
        • Overview
        • API
      • kupu
        • Overview
        • API
      • languageselector
        • Overview
      • lenyadoc
        • Overview
        • API
      • linkcheck
        • Overview
        • API
      • links
        • Overview
        • API
      • lucene
        • Overview
        • API
      • migration
        • Overview
        • API
      • navigation
      • neutron
        • Overview
      • news
        • Overview
        • API
      • notification
        • Overview
        • API
      • opendocument
        • Overview
        • API
      • prettyprinting
        • Overview
      • profiling
        • Overview
      • resource
        • Overview
        • API
      • simplesite
        • Overview
        • API
      • sitetree
        • Overview
        • API
      • sourcerepository
        • Overview
        • API
      • svg
        • Rounded Corners
        • Resizing Images
        • API
      • tinymce
        • Overview
        • API
      • usecasedocument
        • Overview
        • API
      • webdav
        • Getting started
        • Monitoring
        • WebDAV Servers
        • API
      • xhtml
        • Overview
        • API
      • xopus
        • Overview

Current Event

Built with Apache Lenya

Running Lenya Behind Apache with mod_proxy_ajp

Table of Contents
  • Configuring the AJP Connector in Tomcat
  • Configuring the Apache Web Server
  • Advanced Configuration: One Virtual Host per Publications

Configuring the AJP Connector in Tomcat

The file $TOMCAT_HOME/conf/server.xml contains an AJP 1.3 connector on port 8009 by default:

<Connector port="8009" enableLookups="false" redirectPort="8443" protocol="AJP/1.3"/>

If the connector is not present, you have to add it.

Configuring the Apache Web Server

Now we'll declare the virtual hosts for the Apache web server. We assume that the Lenya application runs in the root servlet context (/).

In the simple configuration example the complete URI space of the servlet is accessible at https://cms.example.com/, the authoring environment for the default publication at https://cms.example.com/default/authoring/. This scenario is suitable for most applications, especially if the Lenya instance contains multiple publications. In this example, the authoring environment is only accessible via an SSL connection, which is recommended since the login information is encrypted.

In Apache 2 on Debian Linux the website configuration files are typically located in the directory /etc/apache2/sites-available. On Mac OS X 10.5 the configuration file is /etc/apache2/extra/httpd-vhosts.conf. The contents of the file should look like this:

NameVirtualHost *:80
NameVirtualHost *:443

# This is the SSL host for the authoring environment.
<VirtualHost *:443>
    ServerName cms.example.com
    ServerAlias cms

    ProxyRequests Off

    SSLEngine On
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile /etc/apache2/ssl/server.crt
    SSLCertificateKeyFile /etc/apache2/ssl/server.key

    <Location />
      ProxyPass ajp://localhost:8009/
      ProxyPassReverse https://cms.example.com/
    </Location>

    ErrorLog /var/log/apache2/ssl.cms.example.com-error_log
    CustomLog /var/log/apache2/ssl.cms.example.com-access_log common

</VirtualHost>

# This is the non-SSL host for the live area.
<VirtualHost *:80>
    ServerAdmin webmaster@www.example.com
    ServerName www.example.com
    ServerAlias www

    ProxyRequests Off

    <Location />
      ProxyPass ajp://localhost:8009/default/live/
      ProxyPassReverse http://www.example.com/default/live/
    </Location>

    ErrorLog /var/log/apache2/www.example.com-error_log
    CustomLog /var/log/apache2/www.example.com-access_log common
</VirtualHost>

Advanced Configuration: One Virtual Host per Publications

In the complex configuration example, we provide both SSL and non-SSL access to the authoring environment. Additionally, the publication ID is stripped from the URI, i.e. the authoring environment is accessible at http[s]://cms.example.com/authoring/. This setup is especially useful if you want to provide access to different publications via different virtual hosts.

NameVirtualHost *:80
NameVirtualHost *:443

# This is the non-SSL host for the authoring environment.
<VirtualHost *:80>
    ServerAdmin webmaster@cms.example.com
    ServerName cms.example.com
    ServerAlias cms

    ProxyRequests Off

    RewriteEngine On
    RewriteLog /var/log/apache2/cms.example.com-rewrite_log
    RewriteLogLevel 4
    
    # Redirect the login usecase to https
    RewriteCond %{QUERY_STRING} (.*)lenya\.usecase=ac\.login(.*)
    RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]

    <Location /lenya/>
      ProxyPass ajp://localhost:8009/lenya/
      ProxyPassReverse http://cms.example.com/lenya/
    </Location>

    <Location /modules/>
      ProxyPass ajp://localhost:8009/modules/
      ProxyPassReverse http://cms.example.com/modules/
    </Location>

    <Location /default/modules/>
      ProxyPass ajp://localhost:8009/default/modules/
      ProxyPassReverse http://cms.example.com/default/modules/
    </Location>

    <Location />
      ProxyPass ajp://localhost:8009/default/
      ProxyPassReverse http://cms.example.com/default/
    </Location>

    ErrorLog /var/log/apache2/cms.example.com-error_log
    CustomLog /var/log/apache2/cms.example.com-access_log common
</VirtualHost>

# This is the SSL host for the authoring environment.
<VirtualHost *:443>
    ServerName cms.example.com
    ServerAlias cms

    ProxyRequests Off

    SSLEngine On
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile /etc/apache2/ssl/server.crt
    SSLCertificateKeyFile /etc/apache2/ssl/server.key

    <Location /lenya/>
      ProxyPass ajp://localhost:8009/lenya/
      ProxyPassReverse https://cms.example.com/lenya/
    </Location>

    <Location /modules/>
      ProxyPass ajp://localhost:8009/modules/
      ProxyPassReverse https://cms.example.com/modules/
    </Location>

    <Location /default/modules/>
      ProxyPass ajp://localhost:8009/default/modules/
      ProxyPassReverse https://cms.example.com/default/modules/
    </Location>
    
    <Location />
      ProxyPass ajp://localhost:8009/default/
      ProxyPassReverse https://cms.example.com/default/
    </Location>

    ErrorLog /var/log/apache2/ssl.cms.example.com-error_log
    CustomLog /var/log/apache2/ssl.cms.example.com-access_log common

</VirtualHost>

# This is the non-SSL host for the live area.
<VirtualHost *:80>
    ServerAdmin webmaster@www.example.com
    ServerName www.example.com
    ServerAlias www

    ProxyRequests Off

    <Location />
      ProxyPass ajp://localhost:8009/default/live/
      ProxyPassReverse http://www.example.com/default/live/
    </Location>

    ErrorLog /var/log/apache2/www.example.com-error_log
    CustomLog /var/log/apache2/www.example.com-access_log common
</VirtualHost>

Copyright © 1999-2011 The Apache Software Foundation. All rights reserved.

Apache Lenya, Apache, and the Apache feather logo are trademarks of The Apache Software Foundation.