• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question Modify VirtualServer setting for webmail

jradzuweit

Basic Pleskian
I just solved temporary a sync problem for the webmail with Horde by editing the apache config file
/etc/apache2/plesk.conf.d/webmails/<myDomain>_webmail.conf
Now I want to make this fix permanent, because the above file is generated from the templates in
/usr/local/psa/admin/conf/templates/default/webmail
Actually I want to place the following code in the final domain webmail conf file

HTML:
<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
</IfModule>

Any suggestions to do this best?
 
... the docs suggest to put in ./templates/custom, but I am not familiar with php programming and how to put it in the file
 
here is my solution for this

1. Create the custom file
root@vega:/usr/local/psa/admin/conf/templates# ll
insgesamt 16
drwxr-xr-x 4 root root 4096 Mär 2 2016 ./
drwxr-xr-x 5 root root 4096 Jan 6 06:26 ../
drwxr-xr-x 6 root root 4096 Dez 22 07:14 default/
drwxr-xr-x 3 root root 4096 Mär 2 2016 pci_compliance/
root@vega:/usr/local/psa/admin/conf/templates# mkdir -p custom/webmail
root@vega:/usr/local/psa/admin/conf/templates# cp default/webmail/horde.php custom/webmail/
root@vega:/usr/local/psa/admin/conf/templates# ll custom/webmail/
insgesamt 12
drwxr-xr-x 2 root root 4096 Jan 6 22:34 ./
drwxr-xr-x 3 root root 4096 Jan 6 22:33 ../
-rw-r--r-- 1 root root 1202 Jan 6 22:34 horde.php

2. Append the additional code to the end of the horde.php file,
Here my result, at the end there is the rewrite rule

PHP:
<?php
    /** @var Template_VariableAccessor $VAR */
    $hordeDocroot = $VAR->server->webserver->horde->docroot;
    $hordeSysUser = "horde_sysuser";
    $hordeSysGroup = "horde_sysgroup";
    $hordePhpIni = $VAR->server->webserver->horde->confD . "/horde/php.ini";
?>
    DocumentRoot "<?php echo $hordeDocroot ?>"
    Alias /horde/ "<?php echo $hordeDocroot ?>/"

    <IfModule mod_suexec.c>
        SuexecUserGroup "<?php echo $hordeSysUser; ?>" "<?php echo $hordeSysGroup; ?>"
    </IfModule>

    <IfModule mod_fcgid.c>
        FcgidInitialEnv PP_CUSTOM_PHP_CGI_INDEX fastcgi
        FcgidInitialEnv PP_CUSTOM_PHP_INI "<?php echo $hordePhpIni; ?>"
        FcgidMaxRequestLen 134217728
        <Directory "<?php echo $hordeDocroot ?>">
            <Files ~ (\.php$)>
                SetHandler fcgid-script
                FCGIWrapper <?php echo $VAR->server->webserver->apache->phpCgiBin ?> .php
                Options +ExecCGI
            </Files>

        <?php if ($VAR->server->webserver->apache->useRequireOption): ?>
            Require all granted
        <?php else: ?>
            Order allow,deny
            Allow from all
        <?php endif; ?>
        </Directory>
    </IfModule>

    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
    </IfModule>

3. Check that the syntax of the file is ok
Code:
root@vega:/usr/local/psa/admin/conf/templates/custom/webmail# php -l horde.php
No syntax errors detected in horde.php

4. Create new domain config files

Code:
root@vega:/usr/local/psa/admin# bin/httpdmng --reconfigure-domain <your domain>
and check the file
/etc/apache2/plesk.conf.d/webmails/<your domain>_webmail.conf

That's it
 
Back
Top