In AEMaaCS , for a multi site setup
In conf.d
1. can we have a common vhost code in a seperate file and then reference it in siteA.vhost and siteB.vhost ?
2. How about having common rewrites and site specific rewrites . in which folder we should put them and how to include them in vhost ?
In conf.dispatcher.d
1. can we maintain site specific farms ? and how to manage it using virtualhosts.any file ?
2. how to include site specific filters , like filtersA.any inside filter.any
3. how to include site specific cache rules , like including siteACache.any in site specific farm file
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @VishnuRa5,
Here’s how you can structure a multi-site Dispatcher setup in AEM as a Cloud Service (AEMaaCS).
I’ll break it down by conf.d (Apache HTTPD layer) and conf.dispatcher.d (Dispatcher configs).
In conf.d (Apache vhost layer)
Common vhost code
Yes, you can absolutely put shared logic (like SSL, headers, logging, or other boilerplate config) into a separate include file.
Example:
# conf.d/includes/common_vhost.conf
<IfModule mod_headers.c>
Header always set X-Frame-Options "SAMEORIGIN"
</IfModule>
Then in each site vhost:
Include conf.d/includes/common_vhost.conf
Common vs. site-specific rewrites
Put global rewrites under something like conf.d/rewrites/global_rewrite.rules.
Put site-specific rewrites under conf.d/rewrites/siteA_rewrite.rules, siteB_rewrite.rules.
Reference them in each vhost file:
# Inside siteA.vhost
Include conf.d/rewrites/global_rewrite.rules
Include conf.d/rewrites/siteA_rewrite.rules
In conf.dispatcher.d (Dispatcher layer)
Site-specific farms
Yes, you can maintain separate farm files per site, e.g.:
conf.dispatcher.d/available_farms/siteA_farm.anyconf.dispatcher.d/available_farms/siteB_farm.any
Then symlink them into enabled_farms/.
Use the virtualhosts section in each farm to match requests for that site:
/virtualhosts {
"/sitea.domain.com/*"
"/sitea/*"
}
Site-specific filters
Create files like filtersA.any, filtersB.any.
In your main filter.any you can include them:
$include "filtersA.any"
$include "filtersB.any"
Site-specific cache rules
Same approach. Create siteACache.any, siteBCache.any.
In each farm file, reference its own cache rules:
/cache {
/rules {
$include "../cache/siteACache.any"
}
}
Recommended Folder Structure
conf.d/
├─ available_vhosts/
│ ├─ siteA.vhost
│ ├─ siteB.vhost
│ └─ common_vhost.conf
├─ rewrites/
│ ├─ global_rewrite.rules
│ ├─ siteA_rewrite.rules
│ └─ siteB_rewrite.rules
conf.dispatcher.d/
├─ available_farms/
│ ├─ siteA_farm.any
│ ├─ siteB_farm.any
├─ filters/
│ ├─ filter.any (includes all site filters)
│ ├─ filtersA.any
│ └─ filtersB.any
├─ cache/
│ ├─ siteACache.any
│ └─ siteBCache.any
This way you keep common logic reusable, and still have clean separation for site-specific overrides.
Views
Replies
Total Likes
thankyou verymuch , it worked.
Similar to having a coomon vhost configuration file ,
can we keep common code in farm files in a seperate file and reference it in siteA_farm.any and siteB_farm.any ?
Views
Replies
Total Likes
Yes - you can do the exact same thing with farm files in conf.dispatcher.d.
AEM Dispatcher configs (.any files) support the $include directive, so you can modularize your farms just like you did with vhosts.
Create a shared file for common config
For example:
Inside it you might have things that are identical across all farms, such as:
/renders {
/0001 { /hostname "localhost" /port "4503" }
}
/cache {
/docroot "/mnt/var/www/html"
/allowAuthorized 0
}
Reference it inside each site-specific farm
Example for siteA_farm.any:
/siteA_farm {
$include "../common_farm_parts/common_farm_base.any"
/virtualhosts {
"/sitea.domain.com/*"
"/sitea/*"
}
/filters {
$include "../filters/filtersA.any"
}
/cache {
$include "../cache/siteACache.any"
}
}
Example for siteB_farm.any:
/siteB_farm {
$include "../common_farm_parts/common_farm_base.any"
/virtualhosts {
"/siteb.domain.com/*"
"/siteb/*"
}
/filters {
$include "../filters/filtersB.any"
}
/cache {
$include "../cache/siteBCache.any"
}
}
Views
Replies
Total Likes
Views
Likes
Replies