Dispatcher setup in AEM 6.4

In this post, we will see What is Dispatcher and the role of a dispatcher, and how we can install an Apache web server with how we can do AEM Dispatcher Setup on local? The Table of content is below.



What is a Dispatcher?

Installing Apache Webserver?

Installing dispatcher with AEM?

What is a Dispatcher?

A dispatcher-The Dispatcher is basically a tool that is used in Adobe Experience Manager for Caching or Load Balancing purposes. Which results in a fast, secure, and dynamic web authoring experience.

For cache Dispatcher working as HTTP Server like Apache Web server or Microsoft internet information server. So, the idea here is it stores the content which is static content as much as possible and serves from there rather than hitting the server, which makes it faster accessing and rendering the data.

For load balancing, the Dispatcher distributes user requests (load) across different – different AEM instances. Which results in balancing the traffic on AEM Instance and making the load balanced.

In this tutorial, we are using the Apache webserver for installing the Dispatcher on local. You can also set up the dispatcher using Microsoft Internet Information Server.

Installing Apache Webserver?



I am going to use the Apache webserver 2.2 version. You can download it from https://archive.apache.org/dist/httpd/binaries/win32/

Double click the msi file and click next and finish.If installation is completed successfully it will say IT Works on Browsers. If some error regarding the port so you can change it from httpd.conf file which id located on
(C:\your installation directory/ Apache Software Foundation\Apache2.2\conf) and then restart the server.

 



After that perform the following steps:

 

  • Go to your httpd.conf fileC:\your installation directory/ Apache Software Foundation\Apache2.2\conf
  • Change default Define SRVROOTor ServerRoot  path to absolute path of your apache2.2 folder “C:\your installation directory/ Apache Software Foundation\Apache2.2\conf” (Line – 38).
  • Update listen portListen 8080 (Line – 47), it is optional if you don’t want to change you can keep default port as 80.
  • Update ServerNamelocalhost:8080 (Line – 173), it is optional if you don’t want to change you can keep default port as 80.
  • Go to binfolder and open command prompt run it as administrator.
  • run httpd -k install
  • run httpd -k start

Installing dispatcher with AEM?

Now we have to download and install the Dispatcher in Apache Web Server Steps are:

  • 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 now, We are going to use Apache 2.2 as stated above. You can download it from here.

Download and Unzip the dispatcher zip file.



It contains the following files:-

  • any – It is our dispatcher configuration file.
  • 2.dll– This is my dispatcher module file, which we will plugin with the web server.
  • conf.disp2– sample file to configure apache webserver.
  • any – Sample file for configuring our dispatcher.
  • Now go to Apache installation directory C:\your installation directory/ Apache Software Foundation\Apache2.2\conf and open conf file.
  • Open you conf.disp2 also copy below setting from this file to httpd.conf file
    • Copy LoadModule dispatcher_module  modules/mod_dispatcher.so at (line 234) and paste anywhere in httpd.conf file. I am going to paste it at (line 130) where my load modules are ending.
    • As my dispatcher module name is 2.dll. I will change modules/mod_dispatcher.so in the above line to modules/disp_apache2.2.dll.
    • Now copy the dispatcher level setting from conf.disp2 (Line 236 -284)  as shown below and paste it to httpd.conffile after ending of </IfModule> tag. I am pasting it at (line 146) where my if the module is ending. This set consist of:-
      • DispatcherConfig– It specify the location of the configuration files.
      • DispatcherLog– This refers to the location of the dispatcher’s log files.
      • DispatcherPassError – It is used by dispatcher for handling errors, if set to 1 then webserver will handle errors. There are also options for warning, debug etc you will find it in the same file. like thiserror(0): Errors
      • # warn(1): Warnings
      • # info(2): Info
      • # debug(3): Debug
      • # trace(4): Trace

You can also specify the number like for error you can use 0 and so on.


  • DispatcherKeepAliveTimeout–This refers to the Time interval for which your request should be kept alive.

Now copy the dispatcher handler from httpd.conf.disp2(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. httpd.conf line number might vary in different version search for below code in httpd.conf file:-

<Directory />
AllowOverride none
Require all denied
</Directory>

 

and add below code by creating one more directory tag:-

<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 the 2.dll file from downloaded dispatcher and paste it under Modules folder of Apache web server.
    C:\your installation directory/ Apache Software Foundation\Apache2.2\\modules.
  • Now copy any file from downloaded dispatcher and paste it under
    C:\your installation directory/ Apache SoftwareFoundation\Apache2.2\conf Folder
  • Now open the any file and make few modifications 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 conf Document root 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.



To test the Dispatcher setup hit the url and check the dispatcher.log files inside the logs folder of Apache Web server. Also run the AEM publish instance on 4503 port.

http://localhost:8181/content/we-retail/us/en/men.html

If you it is not working for you can refer the error.log file.

Here is the Dispatcher.any file and httpd.conf file for your reference.

also check another post about multifield in AEM 6.X

If you really find this post useful, you can help me to keep this alive by buying me a cup of Coffee.

 

Stay Safe & Healthy                                              Happy Learning & Coding