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
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:
-
Configuring Dispatcher: https://helpx.adobe.com/experience-manager/kb/HowToConfigureDispatcherForAuthoringEnvironment.html, https://docs.adobe.com/docs/en/dispatcher/disp-config.html
Nhận xét
Đăng nhận xét