Emergency server help: get in touch

DirectAdmin DOCROOT Token Change 1.710: Fix Broken Templates

What DirectAdmin 1.710 changed in the web-server template tokens and subdomain aliasing, how to find custom templates that still use SDOCROOT or REALDOCROOT, and how to bring them in line without losing the customisations they carry.

Published Updated 6 min read

DirectAdmin 1.710 unified the document-root tokens used by the Apache, nginx, OpenLiteSpeed and LiteSpeed templates and stopped adding an automatic www. alias to every subdomain. Servers running stock templates picked the change up transparently at the next configuration rewrite. Servers with customised templates in custombuild/custom/ did not, and the result ranges from sites serving the wrong directory to a web server that refuses to start because a token expanded to nothing. This guide shows how to identify the affected templates and update them.

Short answer: DirectAdmin 1.710 made |DOCROOT| the single document-root token and stopped populating |SDOCROOT| and |REALDOCROOT|, so custom templates that still reference the old tokens render empty roots. Grep custombuild/custom/ for the retired names, replace them with |DOCROOT|, then run da build rewrite_confs and a syntax check before the web server reloads.

What changed

Before 1.710 a domain’s virtual host template could reference |DOCROOT| for the main document root, |SDOCROOT| for a subdomain’s root and |REALDOCROOT| for the physical path behind a custom document root. The three existed because subdomains, custom docroots and pointers each had their own way of computing the path. 1.710 collapsed them: |DOCROOT| now always expands to the correct physical document root for whatever the template is rendering, and the older tokens are no longer guaranteed to be populated. In the same release the templates stopped generating www.sub.example.com aliases for subdomains, and the corresponding DNS records are no longer created for new subdomains.

The upshot is that a custom virtual_host2_sub.conf or nginx_server_sub.conf that has |SDOCROOT| in its DocumentRoot or root line produces an empty value after 1.710.

Find affected templates

Custom templates live under /usr/local/directadmin/custombuild/custom/ in a subdirectory per web server, and older customisations may also sit in /usr/local/directadmin/data/templates/custom/. Search both for the retired tokens:

grep -rn 'SDOCROOT\|REALDOCROOT' /usr/local/directadmin/custombuild/custom/ /usr/local/directadmin/data/templates/custom/ 2>/dev/null

Then check whether the current rendered configuration already contains empty roots, which is the failure in progress:

grep -rn 'DocumentRoot *$' /usr/local/directadmin/data/users/*/httpd.conf | head
grep -rn 'root *;' /usr/local/directadmin/data/users/*/nginx.conf | head

For Apache, httpd -t reports a syntax error on an empty DocumentRoot; nginx accepts an empty root and serves 404s instead, which is why nginx servers often notice the problem later.

Update the templates

The mechanical fix is to replace the retired tokens with |DOCROOT|. Do it on the custom copies only, and compare each custom template with the stock version shipped under /usr/local/directadmin/data/templates/ so you re-apply the customisation to the current template rather than carrying an old base forward:

diff /usr/local/directadmin/data/templates/virtual_host2_sub.conf /usr/local/directadmin/custombuild/custom/ap2/conf/virtual_host2_sub.conf
sed -i 's/|SDOCROOT|/|DOCROOT|/g; s/|REALDOCROOT|/|DOCROOT|/g' /usr/local/directadmin/custombuild/custom/ap2/conf/virtual_host2_sub.conf

Custom templates commonly exist for a reason that has since been added to the stock template, such as a security header block, an Alias for a monitoring path or a .well-known exception. When the diff shows the stock template now includes what the custom one added, delete the custom copy and let the stock version take over. Fewer custom templates means fewer surprises at the next token change.

For the subdomain www. alias, decide whether to restore it. If customers relied on www.blog.example.com, add the alias back in the custom subdomain template with a ServerAlias www.|SUB|.|DOMAIN| line and the DNS record in the subdomain DNS template. Otherwise leave it out; the removal reduced certificate SAN counts, which matters with the 25-name limit per certificate in the ACME system.

Rewrite and test

After editing, regenerate the configuration and validate it before reloading:

da build rewrite_confs
httpd -t
nginx -t

rewrite_confs also reloads the web server, so run the syntax checks first on a copy if the server is busy: httpd -t -f /usr/local/directadmin/data/users/USER/httpd.conf validates a single user’s file without touching the running process.

Common pitfall: the token change in hook scripts

Custom templates are not the only consumers of the old tokens. Post-domain-creation hooks in /usr/local/directadmin/scripts/custom/ sometimes computed the document root from the same variables, and third-party plugins that wrote virtual host snippets did too. Search the scripts directory and any plugin directories for the old names and for hard-coded private_html paths, since 1.711 no longer creates private_html for new domains either:

grep -rln 'SDOCROOT\|REALDOCROOT\|private_html' /usr/local/directadmin/scripts/custom/ /usr/local/directadmin/plugins/*/ 2>/dev/null

Verify

Confirm a subdomain and a domain with a custom document root both serve the correct directory:

grep -A3 'ServerName sub.example.com' /usr/local/directadmin/data/users/USER/httpd.conf | grep DocumentRoot
curl -s https://sub.example.com/ -o /dev/null -w '%{http_code}\n'

The DocumentRoot line should show the full path and the request should return 200. Keep the diff output from this exercise with your change records; the next template revision in the changelog will be easier to assess when you know exactly which lines are yours. For the wider CustomBuild layout of these templates, see CustomBuild web stack: Apache, nginx, OpenLiteSpeed and LiteSpeed.

DirectAdmin DOCROOT token at a glance

DirectAdmin DOCROOT Token Change 1.710 summary card: DirectAdmin 1.710 made |DOCROOT| the single document-root token and stopped populating |SDOCROOT| and |REALDOCROOT|, so…
In short: DirectAdmin 1.710 made |DOCROOT| the single document-root token and stopped populating |SDOCROOT| and |REALDOCROOT|, so custom templates that still reference the old tokens render empty roots.

Official documentation: DirectAdmin documentation, Linux man pages.

Related guides: Using the da CLI: da update, da build, da config-set, da user and update channels · DirectAdmin removed legacy API endpoints in 2025–2026: what they were and their /api/ replacements · Installing DirectAdmin on AlmaLinux 9/10 and Debian 13 (modern license, web installer vs CLI).

Frequently asked questions

Does the DOCROOT token change also affect OpenLiteSpeed and LiteSpeed templates?

Yes. The unification covers all four web-server template sets, so custom OpenLiteSpeed and LiteSpeed virtual host templates under custombuild/custom/ need the same token replacement as the Apache and nginx ones.

How long does fixing the custom templates take?

Usually under an hour on a single server: the grep locates every affected file in seconds and the sed replacement is instant, so most of the time goes into diffing each custom template against the stock version and reloading the web server.

Can I undo this?

Yes. Keep a copy of each custom template before editing; restoring it and running da build rewrite_confs returns the previous configuration, although the old tokens will still expand to empty values on 1.710 or later.

Free website test

Is your website set up right?

Check SSL, security headers, redirects, robots.txt, sitemap, llms.txt and security.txt in one test. It takes about 30 seconds.