Basic File Layout
<- Previous: What is 鈥淭he Dispatcher鈥
This document explains the AMS standard configuration file set and the thinking behind this configuration standard
Default Enterprise Linux folder structure
In AMS the base installation uses Enterprise Linux as the base operating system. When installing Apache Webserver, it has a default install file set. Here are the default files that get installed by installing the basic RPM鈥檚 provided by the yum repository
/etc/httpd/
鈹溾攢鈹 conf
鈹 鈹溾攢鈹 httpd.conf
鈹 鈹斺攢鈹 magic
鈹溾攢鈹 conf.d
鈹 鈹溾攢鈹 autoindex.conf
鈹 鈹溾攢鈹 README
鈹 鈹溾攢鈹 userdir.conf
鈹 鈹斺攢鈹 welcome.conf
鈹溾攢鈹 conf.modules.d
鈹 鈹溾攢鈹 00-base.conf
鈹 鈹溾攢鈹 00-dav.conf
鈹 鈹溾攢鈹 00-lua.conf
鈹 鈹溾攢鈹 00-mpm.conf
鈹 鈹溾攢鈹 00-proxy.conf
鈹 鈹溾攢鈹 00-systemd.conf
鈹 鈹斺攢鈹 01-cgi.conf
鈹溾攢鈹 logs -> ../../var/log/httpd
鈹溾攢鈹 modules -> ../../usr/lib64/httpd/modules
鈹斺攢鈹 run -> /run/httpd
When following and honoring the installation design / structure we gain the following benefits:
- Easier to support a predictable layout
- Automatically familiar to anyone who has worked on Enterprise Linux HTTPD installs in the past
- Allows patching cycles that are fully supported by the Operating System without any conflicts or manual adjustments
- Avoids SELinux violations of mislabeled file contexts
Note
The 51黑料不打烊 Managed Services servers images typically have small Operating System root drives.聽 We put our data in a separate volume which is typically mounted in /mnt
Then we use that volume instead of the defaults for the following default directories
DocumentRoot
- Default:
/var/www/html
- AMS:
/mnt/var/www/html
Log Directory
- Default:
/var/log/httpd
- AMS:
/mnt/var/log/httpd
Keep in mind that the old and new directories are mapped back to the original mount point to eliminate confusion.
Using a separate volume isn鈥檛 vital but it鈥檚 note worthy
AMS Add-ons
AMS adds on to the base install of Apache Web Server.
Document Roots
AMS Default document roots:
- Author:
/mnt/var/www/author/
- Publish:
/mnt/var/www/html/
- Catch-All and Health Check Maintenance
/mnt/var/www/default/
Staging and Enabled VirtualHost Directories
The following directories allow you to build out configuration files having a staging area that you can work on files and only enable then when they are ready.
/etc/httpd/conf.d/available_vhosts/
- This folder hosts all of your VirtualHost / files called
.vhost
- This folder hosts all of your VirtualHost / files called
/etc/httpd/conf.d/enabled_vhosts/
- When you鈥檙e ready to use the
.vhost
files, you have inside theavailable_vhosts
folder symlink them using a relative path into theenabled_vhosts
directory
- When you鈥檙e ready to use the
Additional conf.d
Directories
There are additional pieces that are common in Apache configurations and we created sub directories to allow for a clean way to separate those files and not have all the files in one directory
Rewrites Directory
This directory can contain all of the _rewrite.rules
files you create that contain your typical聽RewriteRulesyntax that engage Apache web servers聽听尘辞诲耻濒别
/etc/httpd/conf.d/rewrites/
Whitelists Directory
This directory can contain all of the _whitelist.rules
files you create that contain your typical聽IP Allow
听辞谤听Require IP
syntax that engage Apache web servers聽
/etc/httpd/conf.d/whitelists/
Variables Directory
This directory can contain all of the .vars
files you create that contain variables you can consume in your configuration files
/etc/httpd/conf.d/variables/
Dispatcher Module-specific Configuration Directory
Apache Web Server is very extensible and when a module has a lot of configuration files it鈥檚 best practice to create your own configuration directory under the install base directory instead of cluttering up the default one.
We follow the best practice and created our own
Module Configuration file directory
/etc/httpd/conf.dispatcher.d/
Staging and Enabled Farm
The following directories allow you to build out configuration files having a staging area that you can work on files and only enable then when they are ready.
/etc/httpd/conf.dispatcher.d/available_farms/
- This folder hosts all of your聽
/myfarm {
聽files called聽_farm.any
- This folder hosts all of your聽
/etc/httpd/conf.dispatcher.d/enabled_farms/
- When you鈥檙e ready to use the farm file, you have inside the available_farms folder symlink them using a relative path into the enabled_farms directory
Additional conf.dispatcher.d
Directories
There are additional pieces that are sub sections of the Dispatcher farm file configurations and we created sub directories to allow for a clean way to separate those files and not have a all the files in one directory
Cache Directory
This directory contains all of the _cache.any
, _invalidate.any
files you create that contain your rules on how you want the module to handle caching elements that come from AEM as well as invalidation rules syntax.聽 More details on this section are here聽here
/etc/httpd/conf.dispatcher.d/cache/
Client Headers Directory
This directory can contain all of the _clientheaders.any
files you create that contain lists of Client Headers you want to pass through to AEM when a request comes in.聽 More details on this section are here
/etc/httpd/conf.dispatcher.d/clientheaders/
Filters Directory
This directory can contain all of the _filters.any
files you create that contain all of your filter rules to block or allow traffic through the Dispatcher to reach AEM
/etc/httpd/conf.dispatcher.d/filters/
Renders Directory
This directory can contain all of the _renders.any
files you create that contain the connectivity details to each backend server that the dispatcher will consume content from
/etc/httpd/conf.dispatcher.d/renders/
Vhosts Directory
This directory can contain all of the _vhosts.any
files you create that contain a list of the domain names and paths to match to a particular farm to a particular back-end server
/etc/httpd/conf.dispatcher.d/vhosts/
Complete Folder Structure
AMS has structured each of the files with custom file extensions and with the intention to avoid namespace issues / conflicts and any confusion.
Here is an example of a standard fileset from an AMS default deployment:
/etc/httpd/
鈹溾攢鈹 conf
鈹偮犅 鈹溾攢鈹 httpd.conf
鈹偮犅 鈹斺攢鈹 magic
鈹溾攢鈹 conf.d
鈹偮犅 鈹溾攢鈹 000_init_ootb_vars.conf
鈹偮犅 鈹溾攢鈹 001_init_ams_vars.conf
鈹偮犅 鈹溾攢鈹 README
鈹偮犅 鈹溾攢鈹 autoindex.conf
鈹偮犅 鈹溾攢鈹 available_vhosts
鈹偮犅 鈹偮犅 鈹溾攢鈹 000_unhealthy_author.vhost
鈹偮犅 鈹偮犅 鈹溾攢鈹 000_unhealthy_publish.vhost
鈹偮犅 鈹偮犅 鈹溾攢鈹 aem_author.vhost
鈹偮犅 鈹偮犅 鈹溾攢鈹 aem_flush.vhost
鈹偮犅 鈹偮犅 鈹溾攢鈹 aem_flush_author.vhost
鈹偮犅 鈹偮犅 鈹溾攢鈹 aem_health.vhost
鈹偮犅 鈹偮犅 鈹溾攢鈹 aem_publish.vhost
鈹偮犅 鈹偮犅 鈹斺攢鈹 ams_lc.vhost
鈹偮犅 鈹溾攢鈹 dispatcher_vhost.conf
鈹偮犅 鈹溾攢鈹 enabled_vhosts
鈹偮犅 鈹偮犅 鈹溾攢鈹 aem_author.vhost -> ../available_vhosts/aem_author.vhost
鈹偮犅 鈹偮犅 鈹溾攢鈹 aem_flush.vhost -> ../available_vhosts/aem_flush.vhost
鈹偮犅 鈹偮犅 鈹溾攢鈹 aem_health.vhost -> /etc/httpd/conf.d/available_vhosts/aem_health.vhost
鈹偮犅 鈹偮犅 鈹斺攢鈹 aem_publish.vhost -> ../available_vhosts/aem_publish.vhost
鈹偮犅 鈹溾攢鈹 logformat.conf
鈹偮犅 鈹溾攢鈹 mimetypes3d.conf
鈹偮犅 鈹溾攢鈹 remoteip.conf
鈹偮犅 鈹溾攢鈹 rewrites
鈹偮犅 鈹偮犅 鈹溾攢鈹 base_rewrite.rules
鈹偮犅 鈹偮犅 鈹斺攢鈹 xforwarded_forcessl_rewrite.rules
鈹偮犅 鈹溾攢鈹 security.conf
鈹偮犅 鈹溾攢鈹 userdir.conf
鈹偮犅 鈹溾攢鈹 variables
鈹偮犅 鈹偮犅 鈹溾攢鈹 ams_default.vars
鈹偮犅 鈹偮犅 鈹斺攢鈹 ootb.vars
鈹偮犅 鈹溾攢鈹 welcome.conf
鈹偮犅 鈹斺攢鈹 whitelists
鈹偮犅 鈹斺攢鈹 000_base_whitelist.rules
鈹溾攢鈹 conf.dispatcher.d
鈹偮犅 鈹溾攢鈹 available_farms
鈹偮犅 鈹偮犅 鈹溾攢鈹 000_ams_catchall_farm.any
鈹偮犅 鈹偮犅 鈹溾攢鈹 001_ams_author_flush_farm.any
鈹偮犅 鈹偮犅 鈹溾攢鈹 001_ams_publish_flush_farm.any
鈹偮犅 鈹偮犅 鈹溾攢鈹 002_ams_author_farm.any
鈹偮犅 鈹偮犅 鈹溾攢鈹 002_ams_lc_farm.any
鈹偮犅 鈹偮犅 鈹斺攢鈹 002_ams_publish_farm.any
鈹偮犅 鈹溾攢鈹 cache
鈹偮犅 鈹偮犅 鈹溾攢鈹 ams_author_cache.any
鈹偮犅 鈹偮犅 鈹溾攢鈹 ams_author_invalidate_allowed.any
鈹偮犅 鈹偮犅 鈹溾攢鈹 ams_publish_cache.any
鈹偮犅 鈹偮犅 鈹斺攢鈹 ams_publish_invalidate_allowed.any
鈹偮犅 鈹溾攢鈹 clientheaders
鈹偮犅 鈹偮犅 鈹溾攢鈹 ams_author_clientheaders.any
鈹偮犅 鈹偮犅 鈹溾攢鈹 ams_common_clientheaders.any
鈹偮犅 鈹偮犅 鈹溾攢鈹 ams_lc_clientheaders.any
鈹偮犅 鈹偮犅 鈹斺攢鈹 ams_publish_clientheaders.any
鈹偮犅 鈹溾攢鈹 dispatcher.any
鈹偮犅 鈹溾攢鈹 enabled_farms
鈹偮犅 鈹偮犅 鈹溾攢鈹 000_ams_catchall_farm.any -> ../available_farms/000_ams_catchall_farm.any
鈹偮犅 鈹偮犅 鈹溾攢鈹 001_ams_author_flush_farm.any -> ../available_farms/001_ams_author_flush_farm.any
鈹偮犅 鈹偮犅 鈹溾攢鈹 001_ams_publish_flush_farm.any -> ../available_farms/001_ams_publish_flush_farm.any
鈹偮犅 鈹偮犅 鈹溾攢鈹 002_ams_author_farm.any -> ../available_farms/002_ams_author_farm.any
鈹偮犅 鈹偮犅 鈹斺攢鈹 002_ams_publish_farm.any -> ../available_farms/002_ams_publish_farm.any
鈹偮犅 鈹溾攢鈹 filters
鈹偮犅 鈹偮犅 鈹溾攢鈹 ams_author_filters.any
鈹偮犅 鈹偮犅 鈹溾攢鈹 ams_lc_filters.any
鈹偮犅 鈹偮犅 鈹斺攢鈹 ams_publish_filters.any
鈹偮犅 鈹溾攢鈹 renders
鈹偮犅 鈹偮犅 鈹溾攢鈹 ams_author_renders.any
鈹偮犅 鈹偮犅 鈹溾攢鈹 ams_lc_renders.any
鈹偮犅 鈹偮犅 鈹斺攢鈹 ams_publish_renders.any
鈹偮犅 鈹斺攢鈹 vhosts
鈹偮犅 鈹溾攢鈹 ams_author_vhosts.any
鈹偮犅 鈹溾攢鈹 ams_lc_vhosts.any
鈹偮犅 鈹斺攢鈹 ams_publish_vhosts.any
鈹溾攢鈹 conf.modules.d
鈹偮犅 鈹溾攢鈹 00-base.conf
鈹偮犅 鈹溾攢鈹 00-dav.conf
鈹偮犅 鈹溾攢鈹 00-lua.conf
鈹偮犅 鈹溾攢鈹 00-mpm.conf
鈹偮犅 鈹溾攢鈹 00-mpm.conf.old
鈹偮犅 鈹溾攢鈹 00-proxy.conf
鈹偮犅 鈹溾攢鈹 00-systemd.conf
鈹偮犅 鈹溾攢鈹 01-cgi.conf
鈹偮犅 鈹斺攢鈹 02-dispatcher.conf
鈹溾攢鈹 logs -> ../../var/log/httpd
鈹溾攢鈹 modules -> ../../usr/lib64/httpd/modules
鈹斺攢鈹 run -> /run/httpd
Keeping it ideal
Enterprise Linux has patching cycles for the Apache Webserver Package (httpd).
The less installed default files you change the better, for reasons that if there is any patched security fixes or configuration improvements are applied via the RPM / Yum command it will not apply the fixes over the top of an altered file.
Instead it creates an .rpmnew
file next to the original.聽 This means you鈥檒l miss some changes you might have wanted and created more garbage in your configuration folders.
i.e. The RPM during update installation will look at httpd.conf
if it鈥檚 in the unaltered
state it will replace the file and you鈥檒l get the vital updates. If the httpd.conf
was altered
then it won鈥檛 replace the file and instead it will create a reference file called httpd.conf.rpmnew
and the many desired fixes will be in that file that doesn鈥檛 apply on service start-up.
Enterprise Linux was set up properly to handle this use case in a better way.聽 They give you areas in which you can extend or override the defaults they set for you.聽 Inside the base installation of httpd you鈥檒l find the file /etc/httpd/conf/httpd.conf
, and it has syntax in it like:
Include conf.modules.d/.conf
IncludeOptional conf.d/.conf
The idea is that Apache wants you to extend the modules and configurations in adding new files to the聽/etc/httpd/conf.d/
听补苍诲 /etc/httpd/conf.modules.d/
聽directories with a file extension of聽.conf
As the perfect example when adding the Dispatcher module to Apache you鈥檇 create a module .so
file in聽 /etc/httpd/modules/
听补苍诲 then include it by adding a file in聽/etc/httpd/conf.modules.d/02-dispatcher.conf
聽with the contents to load your module .so
file
LoadModule dispatcher_module modules/mod_dispatcher.so
Now we consume our module in our file聽 /etc/httpd/conf.d/dispatcher_vhost.conf
聽which initializes our module and loads the initial module-specific configuration file
<IfModule disp_apache2.c>
DispatcherConfig conf.dispatcher.d/dispatcher.any
...SNIP...
</IfModule>
Again you鈥檒l notice we鈥檝e added files and modules but not altered any original files.聽 This gives us the desired functionality and protects us from missing wanted patch fixes as well as keeping to the highest level of compatibility with each upgrade of the package.