Change apache directive for almost each Hestia domains

Well, I think I misasked my question. Let’s forget Wordpress and its specificities.

I just would like to know how to change the Apache DocumentRoot directive for each of the domains installed in Hestia > apache2.conf


please. Thank you

Create a new template

cp default.tpl custom_doc_root.tpl

Modify custom_doc_root.tpl
DocumentRoot %docroot%

to the docroot you want
repeat for stpl and the nginx config is needed

Loads the correct templates via admin

1 Like

@eris, sorry, but I still don’t understand sorry, do I replace %docroot% by ? and %sdocroot% by ?


If you want to forward al the domains to on user test the docroot will be


If you are using a different site for https it will become

/home/test/web/ otherwise /home/test/web/ will work fine

1 Like

My question was after this step > “cp default.tpl custom_doc_root.tpl” do I replace the term between %xxxx% by a domain or a path ?

DocumentRoot %docroot% becomes

DocumentRoot /home/ test /web/ /public_html

This is how it is implemented in the future 1.3.0 release

Ok, did it > modified custom.domain.tpl ant stpl but don’t see choice in admin panel, just “default” under apache drop down menu :no_mouth:

Put it in /apache2/php-fpm folder

Error: apache2 restart failed > inside custom.tpl I change these lines :

DocumentRoot /home/customdomain/web/customdomain/public_html


<Directory /home/customdomain/web/customdomain/public_html>

Check sytemctl status apache2 what is wrong…

seems like error syntax… :

● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2020-09-05 21:01:44 UTC; 23min ago
  Process: 6446 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Sep 05 21:01:44 systemd[1]: Starting The Apache HTTP Server...
Sep 05 21:01:44 apachectl[6446]: AH00526: Syntax error on line 25 of /etc/apache2/conf.d/domains/
Sep 05 21:01:44 apachectl[6446]: Invalid command 'php_admin_value', perhaps misspelled or defined by a module not included in the server configuration

You will need to use the file from /apache2/php-fpm folder

as the /apache2/ contains the template for non php-fpm / “modphp” sites and they won’t work on Apache2 in event mode. (Default)

? sorry, I don’t understand

You will need to use the templates from the correct folder


Will work only for the “non php-fpm” setup still running in Apache2 “Prefork” mode

We have switched for preformance reasons to “Event mode” for Apache2 + PHP-fpm and there for the files can be found in


Those template files can’t be switched between them

Ok, I’m there /usr/local/hestia/data/templates/web/apache2/php-fpm

So if I understand well, my last chance is try to modiy document root directives directly in default.tpl and default.stpl ?

You probably picked the wrong template and template folder then…

Ps: oh sorry, somehow saw the comments above too late :man_facepalming:

tl;dr; what @eris said… :sweat_smile:

still no redirection to main site. I went :


modified : default.tpl and default.stpl

directives :

<VirtualHost %ip%:%web_port%>

    ServerName %domain_idn%
    ServerAdmin %email%
  #  DocumentRoot %docroot%
    DocumentRoot /home/democrasite_admin/web/

    ScriptAlias /cgi-bin/ %home%/%user%/web/%domain%/cgi-bin/
    Alias /vstats/ %home%/%user%/web/%domain%/stats/
    Alias /error/ %home%/%user%/web/%domain%/document_errors/
    #SuexecUserGroup %user% %group%
    CustomLog /var/log/%web_system%/domains/%domain%.bytes bytes
    CustomLog /var/log/%web_system%/domains/%domain%.log combined
    ErrorLog /var/log/%web_system%/domains/%domain%.error.log

    IncludeOptional %home%/%user%/conf/web/%domain%/apache2.forcessl.conf*

    <Directory %home%/%user%/web/%domain%/stats>
        AllowOverride All
    #<Directory %sdocroot%>
    <Directory /home/democrasite_admin/web/>

        AllowOverride All
        Options +Includes -Indexes +ExecCGI

    <FilesMatch \.php$>
        SetHandler "proxy:%backend_lsnr%|fcgi://localhost"
    SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0

    IncludeOptional %home%/%user%/conf/web/%domain%/%web_system%.conf_*


but it doesn’t want to redirect, I always arrive on the default page of the Hestia User/domain = that I want to point to the MainWordpress :


We’re working on it!

This site is currently under construction.

Please check back soon.

I think the redirection is not working or I have a syntax error somewhere.

rather confusing for me, what is the right file to modify then? :no_mouth:

Modifying templates depends on what you’ve installed and is well documentated here:

I made this here:
/usr/local/hestia/data/templates/web/apache2/php-fpm :

cp original.tpl new.tpl
cp original.stpl new.stpl

but maybe I didn’t understand what eris told me:

Those template files can’t be switched between them”.

I understood that then we couldn’t select a different one than “default” in the “apache” menu in the Hestia dashboard?
can I select in the dashboard : new.stpl or let selection on original.tpl ?

in the documentation there is no explanation about changing an apache2 directive to change the DocumentRoot > destination path

What I need to achieve when I use a classic LAMP is to modify the Vhost of a Domain to tell it that its DocumentRoot is the DocumentRoot of another Domain/

On my current VPS my main domain is here:


For a second domain that must point to this location, in its Vhost file the Apache directives are :


DocumentRoot /var/www/democrasite2017
<VirtualHost *:80>
        <Directory /var/www/democrasite2017>
                FollowSymLinks options
                AllowOverride All

on the other hand at the end of the file there is also :

RewriteEngine on
RewriteCond %{SERVER_NAME} [OR]
RewriteCond %{SERVER_NAME}
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} END,NE,R=permanent] [END,NE,R=permanent]

Thanks for your help :slight_smile: