Set up Dispatcher in AEM

In this tutorial i am going to take you through how to set up dispatcher in AEM. Setting up a dispatcher and configuring it, is generally a job of system administrator. But now a days companies are looking for developers who are multi tasking and can also take up the job of system admin along with development as and when required. So it makes it more important to learn how to set up dispatcher in aem for developers also.

After completing this tutorial you should be able to tell:-

What is a Dispatcher:-


Dispatcher is basically used to perform Caching, Load Balancing and filter incoming request from client to AEM publish instances. It also protects our AEM publish servers from attacks by restricting access from unknown sources using filters.

Install Apache Web server on Windows:-

  • Goto http://www.apachehaus.com/cgi-bin/download.plx and download latest binary files.
    download apache webserver msi file
  • Go to your httpd.conf file C:\Ankur\Softwares\httpd-2.4.25-x64-vc14-r1\Apache24\conf
  • Change default Define SRVROOT path to absolute path of your apache24 folder “C:\Ankur\Softwares\httpd-2.4.25-x64-vc14-r1\Apache24” (Line – 38).
  • Update listen port Listen 8080 (Line – 60), it is optional if you dont want to change you ca keep default port as 80.
  • Update ServerName localhost:8080 (Line – 223), it is optional if you dont want to change you ca keep default port as 80.
  • Go to bin folder and open command prompt.
  • run httpd -k install
  • run httpd -k start

Note:- If you are getting error message on command prompt that port already in use, go to httpd.conf, it is dispatcher configuration file. open this file and change the Listen port.

Test successful installation of Apache:-


Goto localhost:8080. If it is successfully installed. you will get apache haus page. Else you will receive a blank screen.

test apache webserver installation

For downloading previous version binary msi file go to http://archive.apache.org/dist/httpd/binaries/win32/ .In this tutorials, I am going to use Apache web server 2.2 version as dispatcher is not supported for windows Apache web server 2.4 and above.

download apache webserver 2.2.25 msi file

Double click the msi file and click next and finish

install apche webserver aem

Note:- If you are getting error message that port already in use update the port number in httpd.conf file(C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf) and restart the server. If webserver is installed successfully then you will recive a scree saying “it works” else you will get a blank screen.

Installing Dispatcher on webserver for windows machine:-


It’s very simple to install and plug in dispatcher on any web server. You just need to follow below steps:-

  • Download dispatcher build
  • Modify Apache web server httpd.conf file
  • Modify dispatcher.any file
  • Restart Apache web server and you are done.

Download dispatcher build:-

Download the latest dispatcher build, but for window as we don’t have dispatcher build for windows. We are going to use Apache 2.2 as stated above.

  • Go to https://www.adobeaemcloud.com/content/companies/public/adobe/dispatcher/dispatcher.html
  • Download dispatcher-apache2.2-windows-x86-4.2.1.zip.
    download dispacher for windows
  • Unzip the downloaded dispatcher zip file. It will contain:-
    • disp_apache2.2.dll – This is my dispatcher module file, which we will plug in with web server.
    • dispatcher.any – It is our dispatcher configuration file.
    • author_dispatcher.any – Sample file for configuring our dispatcher.
    • httpd.conf.disp2.conf – sample file to configure apache webserver.
  • Now got to Apache installation directory C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf and open httpd.conf file.
  • Open you httpd.conf.disp2  also copy below setting from this file to httpd.conf file
    • Copy LoadModule dispatcher_module  modules/mod_dispatcher.so  from (line 234) and paste any where in httpd.conf file. I am going to paste it at (line 130) where my load modules are ending.
      Note:-This setting is used by apache webserver to load my dispatcher when next time Apache web server is started.
    • As my dispatcher module name is disp_apache2.2.dll. I will change modules/mod_dispatcher.so  in above line to modules/disp_apache2.2.dll.
    • Now copy the dispatcher level setting from httpd.conf.disp2.conf (Line 236 -284)  and paste it to httpd.conf file. I am pasting it at (line 146) where my if module is ending). This setting consist of:-
      • DispatcherConfig – location of the configuration file
      • DispatcherLog– location of the dispatcher log file
      • DispatcherPassError – to use your dispatcher for handling errors, if set to 1 then webserver will handle errors.
      • DispatcherKeepAliveTimeout – Time interval fo rwhich your request should be kept alive.

Note:- Do not paste this if module under any existing if module.

    • Now copy the dispatcher handler from httpd.conf.disp2.conf (line 370) to httpd.conf file (line 238) . This will override the default handle of web server and allow dispatcher to entertain all income requests.
<Directory />
 <IfModule disp_apache2.c>
 ModMimeUsePathInfo On
 # enable dispatcher for ALL request. if this is too restrictive,
 # move it to another location
 SetHandler dispatcher-handler
 </IfModule>

 Options FollowSymLinks
 AllowOverride None
</Directory>
  • Now copy this disp_apache2.2.dll  file from downloaded dispatcher and paste it under C:\Program Files (x86)\Apache Software Foundation\Apache2.2\modules.
  • Now copy dispatcher.any file from downloaded dispatcher and paste it under C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf directory.
  • Double click and open dispatcher.any file and let make few modification to make our dispatcher up and running.
    • Go to line 31 and update renders section to point our publish instance. Update the hostname if required currently it is pointing to localhost and port to 4503 (My publish instance port).
    • Go to line 77 and instead of denying all request lets allow all request for testing. For Publish instance you should deny all request and allow specific , For author instance you should allow all and deny specific.
    • Update cache Doc Root. It should exactly match my httpd.conf Documentroot path. Copy Document root path from httpd.conf file and paste it in dispatcher.any file at line 132.
    • Save all settings and Restart your Apache Web server.

Test Dispatcher Installation:-


To test weather dispatcher is configured properly or not.

Note:- If it is not loading make sure publish instance is up and check web server error.log and dispatcher.log for more info.

That’s it, You have successfully set up and configured dispatcher on windows server and plugged in it with AEM 6.2.

For configuring advanced settings in dispatcher. Visit my next tutorial How to Configure Dispatcher in AEM.

Spread the love
  •  
  •  
  •  
  •  
  •  
  •  

Leave a Reply

Your email address will not be published. Required fields are marked *