CUSTOM HTTPD TEMPLATES: read order


Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"


Top Level » Apache Related Information

CUSTOM HTTPD TEMPLATES: read orderLast Modified: Apr 25, 2020, 3:58 pm
Knowing the order in which all of the templates are being loaded in help determine when your tokens will be available.
For this guide, we'll refer to apache/httpd.  If you're running nginx or openlitespeed, the guide still applies, but changes in the template names may apply.  More on the different names in this guide.

  1. Loaded once before each VirtualHost is added:

    CUSTOM_DOMAIN_ITEM_*

  2. WEBSERVER, DOMAIN, HAVE_SAFE_MODE, SSL_TEMPLATE, SPACE_HTTP2, IP, PROXY_IP, HAVE_NGINX_PROXY, PORT_8080, PORT_8081, PROXY_BUFFERING,
    LISTENERS, IF_MODULE_LITESPEED_OPEN, IF_MODULE_LITESPEED_OPEN, IF_MODULE_LITESPEED_CLOSE, IP1|2.., MULTI_IP, HOME, USERHOME, PACKAGE,
    REALUSER, ADMIN, CERT, KEY, HOSTNAME, SAFE_MODE, OPEN_BASEDIR, OPEN_BASEDIR_ENABLED, PHP_MAIL_LOG_ENABLED, CREATOR, BANDWIDTH, QUOTA,
    PORT_80, PORT_443, APACHELOGDIR

  3. CB_VERSION, PHP1_RELEASE, PHP2_RELEASE, LSPHP1_RELEASE, LSPHP2_RELEASE, HAVE_PHP1_FPM, HAVE_PHP2_FPM, HAVE_PHP1_FCGI, HAVE_PHP2_FCGI,
    HAVE_PHP_FCGI, HAVE_RUID2, HAVE_MOD_SECURITY, HAVE_USERDIR_ACCESS, RUID2_AND_MOD_SECURITY,
    (MODSEC_AUDIT_DIR, NGINX_MOD_SECURITY_ENABLE)|NGINX_MOD_SECURITY_ENABLE, USE_HOSTNAME_FOR_ALIAS, HAVE_SUEXEC_PER_DIR, SUSPENDED_REASON,
    CLI, HAVE_PHP1_CLI, HAVE_PHP2_CLI, SUPHP, HAVE_PHP1_SUPHP, HAVE_PHP2_SUPHP, USECANONICALNAME, CAROOT, SERVER_ALIASES

  4. HANDLERS, MIMETYPES, USER, GROUP, SECURE_ACCESS_GROUP, (OLS)SSLPROTOCOL, SDOCROOT, SUSPENDED, CGI, PHP, SUB, FORCE_SSL_REDIRECT

  5. Tokens TOK=value, not templates:

    /usr/local/directadmin/data/admin/global_httpd_tokens.conf
    /usr/local/directadmin/data/users/fred/user.httpd_tokens
    /usr/local/directadmin/data/users/fred/domains/domain.com.httpd_tokens
    /usr/local/directadmin/data/users/fred/domains/domain.com.sub.httpd_tokens

  6. VirtualHost pre, where virtual_host2.conf would be whichever template file is used for this VH. Fully tokenized template.

    /usr/local/directadmin/data/templates/custom/virtual_host2.conf.pre


  7. /usr/local/directadmin/data/templates/cust_httpd.CUSTOM.pre
    /usr/local/directadmin/data/templates/custom/virtual_host2.conf.CUSTOM.pre
    /usr/local/directadmin/data/users/fred/domains/domain.com.cust_httpd
    /usr/local/directadmin/data/templates/custom/virtual_host2.conf.CUSTOM.post
    /usr/local/directadmin/data/templates/cust_httpd.CUSTOM.post


    added to CUSTOM.
  8. For each custom token, 1 through 8 (we'll use 1 for the example):

    /usr/local/directadmin/data/templates/custom/virtual_host2.conf.CUSTOM.1.pre
    /usr/local/directadmin/data/templates/custom/cust_httpd.CUSTOM.1.pre
    /usr/local/directadmin/data/users/fred/domains/domain.com.cust_httpd.CUSTOM.1
    /usr/local/directadmin/data/templates/custom/cust_httpd.CUSTOM.1.post
    /usr/local/directadmin/data/templates/custom/virtual_host2.conf.CUSTOM.1.post


    added to CUSTOM1
  9. PROTECTED_DIRECTORIES, CONTEXTS, REALMS, NGINX_REDIRECTS, OPENLITESPEED_REDIRECTS, HOTLINK_PROTECTION, EXTRA_LOCATIONS, LOCATION_INSERT, NGINX_PHP_CONF

  10. if exists: /usr/local/directadmin/data/templates/custom/virtual_host2.conf
    else: /usr/local/directadmin/data/templates/custom/virtual_host2.conf

Using a token that does not exist yet

Since the above order does matter, if you're using a token which has not yet been fixed, as of DirectAdmin 1.61.0, a change has been done such that any unknown `TOKEN` will be swapped with |TOKEN|, which will be inserted into it's final token location inside the template file by the tokenizer, so at that point, it should be know, and properly filled, instead of being left as `TOKEN` in the template.

 
Related Helpfiles
CUSTOM HTTPD TEMPLATES: Starting point

© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST