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

How to add a new supported language in CQ / WEM (Translator in CQ)

Use case:  You want to add new language to CQ Change display language options in translator grid Change language name and default countries  Solution: You can access translator UI in CQ with following URL http://<HOST>:<PORT>/libs/cq/i18n/translator.html Create new language location for Dictionary Go to CRXDE lite (or your favorite JCR browser) and add this structure (assuming /apps/myapp/i18n as a typical location for custom apps): /apps/myapp/i18n [sling:Folder]     - de [nt:unstructured]         + jcr:mixinTypes = [mix:language]         + jcr:language = de     - fr [nt:unstructured]         + jcr:mixinTypes = [mix:language]         + jcr:language = fr Then reload the translator and the path /apps/ myapp /i18n should show up in the drop-down at the top. Note: the translator will only save translations for languages that are actually present underneath the path (e.g. /apps/myapp/i18n), others will be skipped. Then on jsp pa

Login / Logout on a Publish instance and Closed User Group (CUG)

In CQ5 there is the login logout could be configured using a Closed User Group. Closed User Groups (CUGs) are used to limit access to specific pages that reside within a published internet site. Such pages require the assigned members to login and provide security credentials. http://dev.day.com/docs/en/cq/5-4/howto/create_apply_cug.html The logout using /libs/cq/core/content/login.logout.html always gets redirected to the geometrixx site   http://localhost:4503/content/geometrixx-outdoors/en.html By configuring the Default login page  under the osgi configuration for com.day.cq.auth.impl.LoginSelectorHandler to be – /content/mysite/en/login But still after logout the page goes to the geometrixx site. IIRC, the redirect first goes to to / which then goes through the standard, somewhat complex handling of the root with multiple redirects: 1) / has a resource type of sling:redirect and redirects to /index.html 2) /index.html is handled by the RootMappingServlet [0] which h

[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