• 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

Resolved onyx custom template webmail

moswak

Regular Pleskian
Hi,

centos7
Plesk onyx

in Plesk 12.5 i created in /templates/custom/roundcube.php another alias
i edited
ServerAlias roundcube.webmail.*
to
ServerAlias roundcube.webmail.* mailcc.serverdomain.com

and roundcube was reachable under mailcc.serverdomain.com

but now in onyx the roundcube.php is different and there is no line i can edit ServerAlias
i found in /usr/local/psa/admin/conf/templates/default/webmail/webmail.php
copy this to /usr/local/psa/admin/conf/templates/custom/webmail/webmail.php

Code:
ServerName "webmail.<?php echo $VAR->domain->asciiName ?>"
    <?php foreach ($VAR->domain->mailAliases as $alias): ?>
        ServerAlias  "webmail.<?php echo $alias->asciiName ?>"
    <?php endforeach; ?>

i changed to

Code:
ServerName "webmail.<?php echo $VAR->domain->asciiName ?>"
    <?php foreach ($VAR->domain->mailAliases as $alias): ?>
        ServerAlias  "webmail.<?php echo $alias->asciiName ?>" mailcc.serverdomain.com
    <?php endforeach; ?>

but this doesnt work.
Where is my error ?
 
Code:
ServerAlias "webmail.<?php echo $alias->asciiName ?> mailcc.serverdomain.com"

Does not work :-(

what about /usr/local/psa/admin/conf/templates/default/webmail/nginxWebmailPartial.php ?
but there is no ServerAlias only server_name
 
Hi moswak,

Source: /usr/local/psa/admin/conf/templates/default/webmail/nginxWebmailPartial.php / line 8-14
Code:
<?php foreach ($VAR->domain->webmail->ipAddresses as $ipAddress): ?>
server {
    listen <?php echo $ipAddress->escapedAddress . ':' . $OPT['frontendPort'] . ($OPT['ssl'] ? ' ssl' : '') ?>;
    server_name "webmail.<?php echo $VAR->domain->asciiName ?>";
    <?php foreach ($VAR->domain->mailAliases as $alias): ?>
        server_name  "webmail.<?php echo $alias->asciiName ?>";
    <?php endforeach; ?>
 
Hi moswak,

must i edit both lines with server_name " ?
well, one is for the situation, that you have some aliases configured - so it makes sense to edit both. ;)

Btw.: Pls. remember, that the file "webmail.php" is the template for apache and the file "nginxWebmailPartial.php" is the template for nginx. You should always make sure to edit both depending files, when you make custom changes. ;)
 
Last edited by a moderator:
Code:
listen <?php echo $ipAddress->escapedAddress . ':' . $OPT['frontendPort'] . ($OPT['ssl'] ? ' ssl' : '') ?>;
    server_name "webmail.<?php echo $VAR->domain->asciiName ?> mailcc.serverdomain.com";
    <?php foreach ($VAR->domain->mailAliases as $alias): ?>
        server_name  "webmail.<?php echo $alias->asciiName ?> mailcc.serverdomain.com";

Does not work :-(

edit: and the normal webmail.domain.com loads without css.
I make the changes undo
 
Hi moswak,


Code:
ServerAlias "webmail.<?php echo $alias->asciiName ?> mailcc.serverdomain.com"

I was a little rash with my above answer. Actually, you should use:

For Apache ( webmail.php ) :
Code:
    ServerName "webmail.<?php echo $VAR->domain->asciiName ?>"
    ServerAlias "webmail.<?php echo $VAR->domain->asciiName ?>" "mailcc.serverdomain.com"
    <?php foreach ($VAR->domain->mailAliases as $alias): ?>
        ServerAlias  "webmail.<?php echo $alias->asciiName ?>"
    <?php endforeach; ?>

For nginx ( nginxWebmailPartial.php ) :
Code:
<?php foreach ($VAR->domain->webmail->ipAddresses as $ipAddress): ?>
server {
    listen <?php echo $ipAddress->escapedAddress . ':' . $OPT['frontendPort'] . ($OPT['ssl'] ? ' ssl' : '') ?>;
    server_name "webmail.<?php echo $VAR->domain->asciiName ?>" "mailcc.serverdomain.com";
    <?php foreach ($VAR->domain->mailAliases as $alias): ?>
        server_name  "webmail.<?php echo $alias->asciiName ?>" "mailcc.serverdomain.com";
    <?php endforeach; ?>
 
Last edited by a moderator:
Many thanks, now it works :)

Actually, you should use

You mean that there will soon be changes?
If I have read it correctly then it may be possible in the future to be able to secure webmail.domain.com by let`s encrypt.
Then the code will surely change again and my custom templates no longer work?
 
Hi moswak,

pls. have a look at => #25 for a ( maybe temporary ) solution how to secure the "webmail.*" - domains on your server with the Plesk - Let's Encrypt - extension.

You mean that there will soon be changes?
Then the code will surely change again and my custom templates no longer work?
I expect changes for the Plesk - Let's Encrypt - extension, yes and I expect them in the near future, because this extension is very popular and "doesn't work as expected right now in Plesk Onyx" ( as you can see in quite a few threads/post in the forum ). I'm pretty sure, that the Plesk developers will implement something similar, as the work-around in my above mentioned link. ;)
 
Back
Top