Change apache directive for almost each Hestia domains

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

and

<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
     Docs: https://httpd.apache.org/docs/2.4/
  Process: 6446 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Sep 05 21:01:44 srv-b.democrasite.com systemd[1]: Starting The Apache HTTP Server...
Sep 05 21:01:44 srv-b.democrasite.com apachectl[6446]: AH00526: Syntax error on line 25 of /etc/apache2/conf.d/domains/opaz-ateliers.com.conf:
Sep 05 21:01:44 srv-b.democrasite.com 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

/usr/local/hestia/data/templates/web/apache2

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

/usr/local/hestia/data/templates/web/apache2/php-fpm 

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 :

/usr/local/hestia/data/templates/web/apache2/php-fpm

modified : default.tpl and default.stpl

directives :

<VirtualHost %ip%:%web_port%>

    ServerName %domain_idn%
    %alias_string%
    ServerAdmin %email%
  #  DocumentRoot %docroot%
    DocumentRoot /home/democrasite_admin/web/democrasite.com/public_html

    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>
    #<Directory %sdocroot%>
    <Directory /home/democrasite_admin/web/democrasite.com/public_html>

        AllowOverride All
        Options +Includes -Indexes +ExecCGI
    </Directory>

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

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

</VirtualHost>

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

/home/opaz-ateliers.com/web/opaz-ateliers.com/public_html

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: https://docs.hestiacp.com/admin_docs/server_management.html#how-do-web-templates-work

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:

“/usr/local/hestia/data/templates/web/apache2/php-fpm
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:

/var/www/democrasite2017

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

/etc/apache2/sites-enabled

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

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

RewriteEngine on
RewriteCond %{SERVER_NAME} =www.opaz-ateliers.com [OR]
RewriteCond %{SERVER_NAME} =opaz-ateliers.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} END,NE,R=permanent] [END,NE,R=permanent]
</VirtualHost>

Thanks for your help :slight_smile:

Hi, ScIT :

except Debian Buster, Hestia and Wordpress, I haven’t installed anything. It’s a fresh VPS.

I just need to change the endpoint of a domain declared in Hestia to ask Apache to redirect the entry request and routing to another one.

/home/hestia_user/web/Hestia_domain/public_html

ok guys, I give up and I leave Hestia. It takes too much linux geek knowledge. If doing a simple redirection becomes hell, I don’t dare to imagine what happens next.

The project still seems nice, I’ll come back in a few months, because Wordpress will always exist !

Thanks to all those who tried to help me.

Infact you’re using apache2, there is no reason for a custom template: Add your second domain to “alias” under edit web domain, after that, add the rewrite rule to your htaccess file and all should be done. Just in case you want to give it a try :slight_smile:.

1 Like

@Raphael hi :slight_smile: I tried this “almost” it works yes for wordpress : if I put domain_b in alias_area from domain_a (WordpressMasterMU), domain_b is well redirected to domain_a

But other problems will come ; ssl certificats first for domain_b and what happen if I need to deploy mails boxes for domain_b > mail.domain_b

Yesterday I also tried a 301 redirection from htacess in domain_b /public.html to redirect to domain_a. Completely ignored > still endpoint “We Working on it” page :expressionless:

ssl isn’t a problem, because if you use letsencrypt, it will simply get you a multi-domain cert that works for all domains including the alias ones.

mail isn’t a problem, because mail domains are handled separately and have nothing to do with the web domain aliases. just add your second mail domain and create your mailboxes as with the first domain :man_shrugging:t2:

tl;dr; keep it simple instead of trying to bend the system in a way that’s neither intended nor needed :wink:

have you seen my post on getting wordpress mu working on hestacp?