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...

How to custom CQ Login Module

In order to manage the login process in our project, we will use a custom CQ Login Module. We will admit the root URL of CQ instance is: http://localhost:4502/ . This value may change depending of your environment. The %CQ_HOME% variable we will mention refers to the CQ install path. It admits you have defined %CQ_HOME% as an environment variable. 1.         Update the repository definitions The login module must be referenced in the repository definitions. You have to edit the next file: %CQ_HOME%/crx-quickstart/repository/repository.xml Do a copy of repository.xml to repository.xml.original In repostiory.xml, replace  security  part of repository.xml with following: <Security appName="com.day.crx">         <SecurityManager class="com.day.crx.core.CRXSecurityManager"> <WorkspaceAccessManager class="org.apache.jackrabbit.core.security.simple.SimpleWorkspaceAccessManager"/>  ...

[DAM] Custom DAM management / Add 'Alt' into images

Issue: We need, for each asset to be able to edit the ‘alt’ text. The ‘alt’ text must be used on the site each time an asset is displayed. When displaying an asset, the mechanism is the following : -       Get the Locale from the request -       When getting the asset, get the associated Alt property corresponding to the locale. -       Populate the alt attribute with this value. Resolution: To achieve this, we can customize the DAM Asset Editor. The AssetEditor is the form used to input asset properties and metadata. Below is a screenshot of a customized form with four “alt” input (for four different locales). The DAM uses the following nodes to render Asset Editor forms: -       /libs/dam/content/asseteditors/formitems -       /libs/dam/content/asseteditors/images/formitems -      ...