changing docroot of domain to a custom one in latest directadmin release

mik3ca

Verified User
Joined
May 31, 2026
Messages
14
I'm trying to figure out how to modify the document root of a domain using the latest DirectAdmin. DirectAdmin was downloaded to the server 2 days ago. When I get to the domain configuration screen under the admin account, I can see the contents of the main httpd.conf file that apache loads and i see a bunch of links listing template files in the /usr/local/directadmin/data folder.

When I click on customize, I was expecting to see directadmin code showing what folders the domain points to but all I see are two empty boxes, so then I think there's a way to do it from within the server shell itself. Yes I have full SSH access.

If i modified or created a file in the /etc/httpd/conf/extra folder (I think that's where it is where the miscellaneous files are loaded for apache), what special command would I need to run to make DirectAdmin understand the changes before restarting/reloading apache?

And will those files in the extra folder remain in-tact, or will they be overwritten by DirectAdmin?

I ask because I prefer to update the docroot through SSH without DirectAdmin screwing up the settings afterwards, and its apparent if I modify the httpd.conf in the /etc/conf folder then it will be overwritten.

Thanks.
 
You should be able to change the docroot via directadmin anyway? Maybe it's more helpfull if you can explain which docroot you want to have.

Best is to not change any of the template files. There are instructions in the docs how to customize them in a /custom directory.

Same for changes in the /etc/httpd/conf/extra because those won't be changed on an Apache update.
You need to use the instructions for customisation.

Check these docs especially:
and

Changing the docroot can be done like this too:
 
Say for example, I setup a domain exclusively through DirectAdmin, then later in Linux I store the website contents in ram and want to set docroot to that.

Let's assume the mount point is the folder /ramroot on the entire server and it has the same permissions as the original docroot for the domain.

In a typical virtualhost block in a standard apache configuration, I would use this line:

Code:
DocumentRoot /ramroot

After looking at your docs, I believe the best way is to copy the existing virtualhost block for the domain on the server, append the block to the end of the file /etc/httpd/conf/extra/httpd-includes.conf and change the DocumentRoot accordingly.

Or is there something I am missing?
 
I read all that but I do not see what you're describing.

I am at this page for trying to configure docroot:


I see my domain name listed then I see httpd.conf and php-fpm.conf 8.2

When I click on httpd.conf it shows that current file with a list of template files.

When I click on customize I see 2 empty boxes.

I'm gonna take a gamble and modify a file in the http conf extra subfolder direct on the server and see if I get lucky.
 
When I click on customize I see 2 empty boxes.

Use the empty boxes aka "textarea" to enter custom directives to overwrite existing data in virtualhosts and click a "save" button.

In your case you will need to enter the mentioned line in the section "CUSTOM" and click "save". Make sure to use a correct path right to the equal sign.
 
Hi - new DirectAdmin user here.

Does anyone know if there's a reason why changing the document root for a subdomain is ridiculously easy (click edit, enter the new path in a text box, click save), and changing the document root for a domain is much more difficult (go to httpd customization, manually enter changes in an unfamiliar templating language, click save, hope it works)?

I count myself lucky that the snippet I needed was in the documentation...I probably would have spent a ton of time trying to get this to work on my own.

|*if !SUB|
|?DOCROOT=/new/path/you/want|
|*endif|
 
and changing the document root for a domain is much more difficult
Because in most cases there is not really a reason to change a domain document root, everything normally works from some default directory like most panels have public_html and some have www.

So the requirement for a different documentroot for a domain is mostly cause by some app which is not programmed optimally. In other words, too little requests for it, haven't seen in cPanel and if I'm correct in Plesk either.

For example, why do you need an alternative document root for the domain?
 
Hi Richard - thank you for the clarification, and sorry if my other post came off as complain-y. It seems like the need to update document root has come up often for me, but it must not be that common.

In this particular case, I'm deploying a web app from a Git repo where the files are split between 'private' and 'public' folders and the 'public' folder should be the document root. I was thinking I had to point the Apache document root at the 'public' folder, but now I see a better way to do it is to delete public_html and create a symbolic link between public->public_html and avoid the Apache config altogether.

Anyway, appreciate the quick reply.
 
The docroot issue has been a recurring problem for years, generating hundreds of support tickets annually and frustrating customers who are blocked from continuing their work until our support team steps in.

To address this, we invested several weeks in developing a plugin that resolves the issue at its root. It has been running flawlessly across our entire Apache server farm for several months now. At present, the plugin supports Apache only; LiteSpeed and OpenLiteSpeed support is planned for mid-August.

If you are interested in testing it, feel free to send me a PM.
 
Back
Top