CQ Dispatcher Apache Set Up





CQ Dispatcher


Set up Dispatcher on Apache

Install Apache:
  • Based on version of Apache instruction could be different 
  • Please refer http://httpd.apache.org/docs/2.2/install.html to download and install
  • You can also use quick instruction for mac (Your own Apache) as follows

Install Apache on Mac

It is also part of xcode http://developer.apple.com/technologies/tools/

  1. Download latest apache built from http://httpd.apache.org/download.cgi#apache22
  2. install using direction given in http://httpd.apache.org/docs/2.2/install.html
  3. Make sure that for PREFIX you use current location
  • Follow steps

Download $ lynx http://httpd.apache.org/download.cgi

Extract $ gzip -d httpd-NN.tar.gz

$ tar xvf httpd-NN.tar

$ cd httpd-NN

Configure       $ ./configure --prefix=PREFIX

Compile $ make

Install $ make install

Customize       $ vi PREFIX/conf/httpd.conf

Test    $ PREFIX/bin/apachectl -k start



Install Dispatcher on Apache:
  • Get dispatcher from Adobe. You can use Package Share to get dispatcher. More information can be obtained from here
  • File name follow format dispatcher-<web-server>-<operating-system>-<dispatcher-version-number>.<file-format>
  • Installation file contains following files depending upon version of apache (On windows or unix based)

Apache Dispatcher Zip Content

File Description
disp_apache<x.y>.dll Windows:
The Dispatcher dynamic link library file.
dispatcher-apache<x.y>-<rel-nr>.so Unix:
The Dispatcher shared object library file.
mod_dispatcher.so Unix:
An example link.
http.conf.disp<x> An example configuration file for the Apache server.
dispatcher.any An example configuration file for the Dispatcher.
README.dispatcher.apache Readme file holding installation instructions and last-minute information.
Note: Please check this file before starting the installation.
release-notes.txt
The release notes; listing issues fixed in the current and past releases.

  • Use following steps to add dispatcher on apache web server

Dispatcher Specific Configuration

  • Place the Dispatcher file in the appropriate Apache module directory:

    • Windows: Place disp_apache<x.y>.dll <APACHE_ROOT>/modules
    • Unix: Locate either the <APACHE_ROOT>/libexec or <APACHE_ROOT>/modules directory according to your installation.
      Copy dispatcher-apache<options>.so into this directory.
      To simplify long-term maintenance you can also create a symbolic link named mod_dispatcher.so to the Dispatcher:
      ln -s dispatcher-apache<x>-<os>-<rel-nr>.so mod_dispatcher.so
  • Copy the dispatcher.any file to the <APACHE_ROOT>/conf directory.


    1. Navigate to <APACHE_ROOT>/conf.
    2. Open httpd.conf for editing.
    3. The following configuration entries must be added, in the order listed:
      • LoadModule to load the module on start up.
      • AddModule to enable the module. (Apache 1.3 only).
      • Dispatcher-specific configuration entries, including DispatcherConfig, DispatcherLog and DispatcherLogLevel.
      • SetHandler to activate the Dispatcher. LoadModule.
      • ModMimeUsePathInfo to configure behavior of mod_mime.

    The following configuration steps are optional, but recommended:

    1. Change the owner of the htdocs directory:
      • The apache server starts as root, though the child processes start as daemon (for security purposes). The DocumentRoot (<APACHE_ROOT>/htdocs) must belong to the user daemon:
            cd <APACHE_ROOT>
            chown -R daemon:daemon htdocs
    2. The following table lists examples that can be used; the exact entries are according to your specific Apache Web Server:

       Windows ...
      LoadModule dispatcher_module modules\disp_apache.dll
      ...
       Unix
       (assuming  symbolic link)
      ...
      LoadModule dispatcher_module libexec/mod_dispatcher.so
      ...

    • These are Dispatcher specific configuration entries

    Apache Dispatcher Specific Configuration

    Windows
    and
    Unix
     ...
    <IfModule disp_apache2.c>
      DispatcherConfig conf/dispatcher.any
      DispatcherLog    logs/dispatcher.log
      DispatcherLogLevel 3
      DispatcherNoServerHeader 0
      DispatcherDeclineRoot 0
      DispatcherUseProcessedURL 0
      DispatcherPassError 0
    </IfModule>
    ...

    The individual configuration parameters:

    DispatcherConfig Location and name of the configuration file.
    DispatcherLog Location and name of the log file.
    DispatcherLogLevel Log level for the log file:
    0 - Errors
    1 - Warnings
    2 - Infos
    3 - Debug
    Note: It is recommended to set the log level to 3 during installation and testing, then to 0 when running in a production environment.
    DispatcherNoServerHeader Defines the Server Header to be used:
    undefined or 0 - the HTTP server header contains the AEM version.
    1 - the Apache server header is used.
    DispatcherDeclineRoot Defines whether to decline requests to the root "/":
    0 - accept requests to /
    1 - requests to / are not handled by the dispatcher; use mod_alias for the correct mapping.
    DispatcherUseProcessedURL Defines whether to use pre-processed URLs for all further processing by Dispatcher:
    0 - use the original URL passed to the web server.
    1 - the dispatcher uses the URL already processed by the handlers that precede the dispatcher (i.e. mod_rewrite) instead of the original URL passed to the web server.

    For example, either the original or the processed URL is matched with Dispatcher filters. The URL is also used as the basis for the cache file structure. 

    See the Apache web site documentation for information about mod_rewrite; for example, Apache 2.2. When using mod_rewrite, it is advisable to use the flag 'passthrough|PT' (pass through to next handler) to force the rewrite engine to set the uri field of the internal request_rec structure to the value of the filename field.
    DispatcherPassError
    Defines how to support 40x error codes for ErrorDocument handling:
    0 - the dispatcher spools all error responses to the client.
    1 - the dispatcher does not spool an error response to the client (where the status code is greater or equal than 400), but passes the status code to Apache, which e.g. allows an ErrorDocument directive to process such a status code.

    • Then In order for apache to use dispatcher as request handler, You have to add SetHandler configuration

    Dispatcher Set Handler Configuration

    Windows
    and
    Unix
    ...
    <Directory />
      <IfModule disp_apache2.c>
        SetHandler dispatcher-handler
      </IfModule>

      Options FollowSymLinks
      AllowOverride None
    </Directory>
    ...

    The following example configures the Dispatcher to handle requests for a virtual domain:

    Windows ...
    <VirtualHost 123.45.67.89>
      ServerName www.mycompany.com
      DocumentRoot [cache-path]\docs
      <Directory [cache-path]\docs>
        <IfModule disp_apache2.c>
          SetHandler dispatcher-handler
        </IfModule>
        AllowOverride None
      </Directory>
    </VirtualHost>
    ...
    Unix  ...
    <VirtualHost 123.45.67.89>
      ServerName www.mycompany.com
      DocumentRoot /usr/apachecache/docs
      <Directory /usr/apachecache/docs>
        <IfModule disp_apache2.c>
          SetHandler dispatcher-handler
        </IfModule>
        AllowOverride None
      </Directory>
    </VirtualHost>
    ...

    Sample Files:
    1. Sample Dispatcher.any file
    2. Most Simple httpd.conf file

    Very Simple httpd.conf

    ServerName apache

    Listen 8082

    User apache

    ServerRoot /etc/httpd

    DocumentRoot /var/www/html

    ServerAdmin webmaster@nowhere.com

    LoadModule autoindex_module modules/mod_autoindex.so

    LoadModule dir_module modules/mod_dir.so

    LoadModule dispatcher_module  modules/mod_dispatcher.so

    LoadModule mime_module modules/mod_mime.so

    TypesConfig conf/mime.types

    ModMimeUsePathInfo On #Added to resolve issues in dispatcher bug #34466

    KeepAlive on

    KeepAliveTimeout 15

    TimeOut 30

    <IfModule disp_apache2.c>

           DispatcherConfig conf/dispatcher.any

           DispatcherLog    logs/dispatcher.log

           DispatcherLogLevel 3

           DispatcherNoServerHeader 0

           DispatcherDeclineRoot 1

           DispatcherUseProcessedURL 1

    </IfModule>

    <Directory />

       #Options -Indexes -MultiViews -FollowSymLinks #Note: Allow symlinks if mod_rewrite is needed

       AllowOverride None

       <IfModule disp_apache2.c>

           SetHandler dispatcher-handler

       </IfModule>

    </Directory>



    Some Important CQ Dispatcher Links:

        

                                                                                                                       
              
                                                                                                                                    
    Comments