Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Host static site in dispatcher


Level 4

Hi ,

Recently we got requirement to host a site in our AEM environment.The site will be always static with few image ,css and js .

We got the html file along with the other required contents (images, css, js fonts etc).

We are planning to create a directory inside "/opt/communique/dispatcher/cache/content" called "newsite"

/opt/communique/dispatcher/cache/content/newsite ,so that it serves from the dispatcher cache always.

Any idea how can we achieve this.When i hit the newsite.html it does not load the images .

Also is there any other easy way to host this static site in AEM dispatcher.



9 Replies


Level 10

Have you already built a site in AEM or outside AEM?

Where is it hosted - in AEM or outside AEM?

Does AEM dispatcher talk to AEM publish server for fetching the content and is it configured per Adobe's recommended guidelines?


Level 4

We have already build our primary sites e.g abc.com , xyz.ca  in AEM which is as per Adobe's recommended guideline.

Now we have a new requirement to host one static site "qwe.com" in AEM. And for this we really don't want to put anything in author and publisher side.Just want to put the static files(html,css,js,and fonts) in dispatcher layer.Is this possible?

Or please suggest any other suitable workaround.




If you want to serve content statically then you will have to configure something like this for site configurations on paths that you don't want to be served by the dispatcher-handler:

<Location />

<IfModule disp_apache2.c>

SetHandler dispatcher-handler



<Location /favicon.ico>

SetHandler default-handler





Level 10

Technically, this is possible but may not be recommended due to various reasons if you plan to use the same domain for both AEM served content and static content served by web server. This static content would not be managed by Dispatcher in any way but by the web server. You may setup virtual domains/sub-domains or similar solutions based on your requirement.

Follow the best practices/security considerations for each module.

Rather than mounting dispatcher on root ('/'), mount it on a specific pattern for AEM served content and let some other path say /foo to be statically served by apache or do the vice versa using lookahead regex.

Based on you AEM site's dispatcher design, you would need to test that there are no issues in caching/flushing/generation of stat files for the dispatcher managed/mounted path.

Have a separate CI/CD pipeline to compile/transpile/package/deploy your static code into the web server.



Another solution for this would be to have multiple virtual hosts within Apache. Each virtual host would have its own separate document root. Avoid nested the sites within each other folder structure. The static site will reside in one location and the site serving content from AEM will be in a separate location. Just make sure the Dispatcher configuration manage content in one location.


Level 4


We have created the virtual hosts /var/www/html/newsite/newsite.html

And add below configuration in httpd.conf.As soon as we added this now AEM contents are not serving getting 404.Because By default, all requests are taken from this directory /var/www/html.

<Directory "/var/www/html">

         SetHandler default-handler


Any idea how can we separate both traffic.


Level 10

Assuming that you're asking for how to setup virtual host config--

Using Dispatcher with Multiple Domains

set up one for dispatcher served content and other for apache served content

<VirtualHost *:80> ServerName branda.com DocumentRoot /usr/lib/apache/httpd-2.4.3/htdocs/content/sitea <Directory /usr/lib/apache/httpd-2.4.3/htdocs/content/sitea> <IfModule disp_apache2.c> SetHandler dispatcher-handler ModMimeUsePathInfo On </IfModule> Options FollowSymLinks AllowOverride None </Directory> </VirtualHost> 

VirtualHost Examples - Apache HTTP Server Version 2.4

Keep separate docroots & directory paths

 DocumentRoot /usr/lib/apache/httpd-2.4.3/htdocs/content/sitea  and 
<Directory /usr/lib/apache/httpd-2.4.3/htdocs/content/sitea>

DocumentRoot /usr/lib/apache/httpd-2.4.3/htdocs/content/siteb and

<Directory /usr/lib/apache/httpd-2.4.3/htdocs/content/siteb>

If you plan to use the same shared location "/var/www/html" as mentioned in my above post, then use <Location>  or <LocationMatch> tags


Level 4

Hi All,

We have configured the site bit different way.We put the contents (html,image and assets css js etc) inside

e.g /var/www/html/newsite/index.html                      

And created a softlink of newsite folder in ur docroot  and configure the rewrite rule in httpd.conf  accordingly .Its working fine.


Thanks all for your suggestion.