Chuyển đến nội dung chính

[AEM] Setting Up a Dispatcher on OS X

Setting Up a Dispatcher on OS X


Purpose: This guild is to show you how to set up a dispatcher on OS X step by step

Prepare:
1.         OS X machine with Apache installed and enabled
2.         Start AEM 5.6.1 quickstart
author on: 4502
publish on: 4503

Configure:
1.         Figure out which version of Apache httpd you’re working with:
$ httpd –v
In my case:
Server version: Apache/2.4.18 (Unix)
Server built:   Feb 20 2016 20:03:19

2.         Download and extract the correct dispatcher version for your httpd:
Inside the extracted directory you will find a file named ‘dispatcher-apache<version>.so’.

Copy this file to /usr/libexec/apache2. In my case:
$ sudo cp dispatcher-apache2.4-4.2.0.so /usr/libexec/apache2

Note: If you can not copy file into /usr/libexec/apache2 even though you are admin/root. It because your OS X is enabling SIP (System Integrity Protection), please disable it follow http://www.macworld.co.uk/how-to/mac/how-turn-off-mac-os-x-system-integrity-protection-rootless-3638975/

3.         Go to the apache2 modules directory:
$ cd /usr/libexec/apache2/

Create a symlink to the dispatcher module you just copied over:
sudo ln -s dispatcher-apache2.4-4.2.0.so mod_dispatcher.so

4.         Go to /etc/apache2 to configure it:
$ cd /etc/apache2

Open httpd.conf (as root) with your editor of choice and add the following lines to the end of the LoadModule section (line 170 in my case):
LoadModule dispatcher_module libexec/apache2/mod_dispatcher.so

# configure the minimal setting for the dispatcher
# the main configuration is read from the 'DispatcherConfig' file.
<IfModule disp_apache2.c>
    # location of the configuration file. eg: 'conf/dispatcher.any'
    DispatcherConfig /etc/apache2/conf/dispatcher.any

    # location of the dispatcher log file. eg: 'logs/dispatcher.log'
    DispatcherLog    /var/log/apache2/dispatcher.log

    # log level for the dispatcher log
    # 0 Errors
    # 1 Warnings
    # 2 Infos
    # 3 Debug
    DispatcherLogLevel 3

    # if turned to 1, the dispatcher looks like a normal module
    # since build 5210, this setting has no effect, since it used to crash
    # apache if set to 0.
    DispatcherNoServerHeader 1

    # if turned to 1, request to / are not handled by the dispatcher
    # use the mod_alias then for the correct mapping
    DispatcherDeclineRoot 0
</IfModule>

<Directory />
    <IfModule disp_apache2.c>
        # enable dispatcher for ALL request. if this is too restrictive,
        # move it to another location
        SetHandler dispatcher-handler
        ModMimeUsePathInfo On
    </IfModule>

    Options FollowSymLinks
    AllowOverride None
</Directory>


Create a directory named ‘conf’ in /etc/apache2
$ sudo mkdir /etc/apache2/conf

From the extracted dispatcher directory, copy the provided dispatcher.any to conf:
$ cd ~/Downloads/dispatcher-apache2.4-darwin-x86-64-4.2.0/conf/
$ sudo cp dispatcher.any /etc/apache2/conf/

Open the copy of dispatcher.any with your editor of choice. Look for the ‘/renders’ entry, and point the ‘/rend01’ instance host name and port to your publish instance:
/hostname "127.0.0.1"
/port "4503"

Allow requests with authorized header (uncomment and change value) in dispatcher.any:
/allowAuthorized "1"

Set the document root directory (search for the existing value):
/docroot "/Library/WebServer/Documents"

Check your config syntax:
$ sudo apachectl configtest

The previous command should have outputted ‘Syntax OK’.
Did it not? You may need to correct your configuration. ‘apachectl configtest’ should be able to tell you on which line your config is broken.

Give your httpd document root directory to the _www user and group:
$ sudo chown _www:_www /Library/WebServer/Documents/

Stop Apache httpd:
$ sudo apachectl stop

In another terminal window (or tab), tail the following log files for errors:
$ tail -f /var/log/apache2/error_log /var/log/apache2/dispatcher.log

There is no error in the logs you should now be able to browse your AEM publish content via the dispatcher:

You can also poke around /Library/WebServer/Documents/ to see how the static content is stored on the file system.

To install dispatcher on other environments please see in https://docs.adobe.com/docs/en/dispatcher/disp-install.html

That’s it! You’ve just configured your very own dispatcher. I’ve only scratched the surface here and really glazed over much of the configuration, so make sure to read the following resources before releasing this dispatcher into the wild:
-               Dispatcher: http://dev.day.com/docs/en/cq/current/deploying/dispatcher.html
-               Security Checklist: http://dev.day.com/docs/en/cq/current/deploying/security_checklist.html


Nhận xét

Bài đăng phổ biến từ blog này

[PERFORMANCE] Adobe WEM/CQ performance tuning

Adobe WEM/CQ performance tuning Contents Caching-related configurations CRX Bundle cache CRX Search index handler (Lucene) cache Tar PM index cache Scalability Maintenance Optimizing Tar Files (for Tar Persistence Manager) Data Store Garbage Collection Main documentation you should consult first: http://dev.day.com/docs/en/cq/current/deploying/performance.html http://dev.day.com/content/kb/home/cq5/CQ5Troubleshooting/performancetuningtips.html Caching-related configurations CRX Bundle cache CRX caches bundles, consisting of a node with all its properties. This is used by all bundle-based Persistence Managers. The default size of BundleCache is 8 MB. If this is too small it can cause an excessive number of read-accesses to the underlying persistence layer. Set the bundleCacheSize to something larger than the default. See more here: http://dev.day.com/docs/en/cq/current/deploying/performance.html#CRX%20Bundle%20Cache CRX Search index handler (Lucene...

[Query Builder] Advanced Search

Using the Advanced Search When using a list, select from the 'Build list using' options 'Advanced Search.' This will open a new tab in the list window with one text box labeled: 'Querybuilder Predicate Notation.' This is asking for a few lines of code to define search parameters. Example Code - With Explanations of Results Searching for Pages type=cq:Page property=jcr:content/jcr:title property.value=Places 'type' defines what sort of object you'll be searching for (it's usually a page). 'property' defines what property of the object you'll be filtering by; in this case, its by the title. 'property.value' defines your search term. So this search would be searching all PAGES with the TITLE of PLACES. So it would find every page titled Places. *IMPORTANT* Searches by title ARE case-sensitive, so 'Places' is not the same as 'places'. type=cq:Page path=/cq/sandbox property=jcr:cont...

[CQ6-SYSTEM] MAINTAINING THE REPOSITORY - Reduce repository size (cleanup repository)

Compacting Tar Files As data is never overwritten in a tar file, the disk usage increases even when only updating existing data. To make up for the growing size of the repository, AEM employs a garbage collection mechanism called Tar Compaction. The mechanism will reclaim disk space by removing obsolete data from the repository. Revision Clean Up By default, tar file compaction is automatically run each night between 2 am and 5 am. The automatic compaction can be triggered manually in the Operations Dashboard via a maintenance job called Revision Clean Up. To start Revision Clean Up you need to: Go to the AEM Welcome Screen. In the main AEM window, go to Tools - Operations - Dashboard - Maintenance or directly browse to http://localhost:4502/libs/granite/operations/content/maintenance.html Click on Daily Maintenance Window. Hover over the Revision Clean Up window and press the Start button. The icon will turn orange to indicate that the Revision Clean Up ...