• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

change webmail.domain.com to domain.com/mail

Chrisa

Basic Pleskian
Want to be able to change webmail.domain.com to domain.com/webmail

same problem as this thread:

https://talk.plesk.com/threads/webmail-question.326784/#post-780422
[Thread poster had errors and the thread went dead, I'm getting the same errors, have included all details below]

the thread is based on this instruction:
http://download1.parallels.com/Ples...nistration-guide/index.htm?fileName=68693.htm

Details:
Plesk 12.5.30
OS Ubuntu 14.04.4 LTS
# apache2 -v
Server version: Apache/2.4.7 (Ubuntu)


Commands and Results:
cp /usr/local/psa/admin/conf/templates/default/nginxDomainWebmail.php /usr/local/psa/admin/conf/templates/custom/
cp /usr/local/psa/admin/conf/templates/default/domainWebmail.php /usr/local/psa/admin/conf/templates/custom/

nano /usr/local/psa/admin/conf/templates/custom/nginxDomainWebmail.php

FROM:
ServerAlias "webmail.<? Php echo $ VAR> domain-> asciiName?>"
<? php foreach ($ VAR> domain-> mailAliases AS $ alias):>
ServerAlias "webmail.<? Php echo $ alias-> asciiName?>"
<? php endforeach; ?>

TO:
ServerAlias "<? Php echo $ VAR> domain-> asciiName?>/webmail"
<? php foreach ($ VAR> domain-> mailAliases AS $ alias):>
ServerAlias "<? Php echo $ alias-> asciiName?>/webmail"
<? php endforeach; ?>

NOTE: No copy and paste into nano, only using home, end, arrow keys, delete

php -l /usr/local/psa/admin/conf/templates/custom/domainWebmail.php
No syntax errors detected in /usr/local/psa/admin/conf/templates/custom/domainWebmail.php

nano /usr/local/psa/admin/conf/templates/custom/domainWebmail.php

FROM:
ServerAlias "webmail.<? Php echo $ VAR> domain-> asciiName?>"
<? php foreach ($ VAR> domain-> mailAliases AS $ alias):>
ServerAlias "webmail.<? Php echo $ alias-> asciiName?>"
<? php endforeach; ?>

TO:
ServerAlias "<? Php echo $ VAR> domain-> asciiName?>/webmail"
<? php foreach ($ VAR> domain-> mailAliases AS $ alias):>
ServerAlias "<? Php echo $ alias-> asciiName?>/webmail"
<? php endforeach; ?>

NOTE: No copy and paste into nano, only using home, end, arrow keys, delete

php -l /usr/local/psa/admin/conf/templates/custom/nginxDomainWebmail.php
No syntax errors detected in /usr/local/psa/admin/conf/templates/custom/nginxDomainWebmail.php

/usr/local/psa/admin/bin/httpdmng --reconfigure-all
service apache2 restart
service nginx restart

Error on each domain:
nginx: [warn] server name "DOMAIN.TLD/webmail" has suspicious symbols in /etc/nginx/plesk.conf.d/webmails/DOMAIN.TLD_webmail.conf:6

As a test I removed the / from both files, reconfigured, restarted and the nginx error went away so nginx really doesn't seem to like the backslash.

What am I missing?

Thanks in advance.
 
Hi Chrisa,

nginx: [warn] server name "DOMAIN.TLD/webmail" has suspicious symbols in /etc/nginx/plesk.conf.d/webmails/DOMAIN.TLD_webmail.conf:6

Pls. be so kind to post the content of your file "/etc/nginx/plesk.conf.d/webmails/DOMAIN.TLD_webmail.conf" in CODE - brackets, for further investigations.




( How to quote, or put CODE into a box? Very easy... just click on the "Insert ..." - button ).
Insert_Button_001.png
 
Hi UFHH01,

I checked each of the files and they all are in the same format, where DOMAIN.TLD = the actual domain.

Update: When I 1st posted the code it was after undoing the changes, so I posted both conditions for clarification

Normal Configuration
Code:
#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

server_name "webmail.DOMAIN.TLD";

Modified Configuration
Code:
#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

server_name "DOMAIN.TLD/webmail";


I you require anything else please let me know.

Thanks again
Chris
 
Last edited:
Hi Chrisa,

the problem is indeed, that a "server_name" definition can't be set with a slash, that was a mistake in my suggestion ( https://talk.plesk.com/threads/webmail-question.326784/#post-780422 - I will answer in this thread with my apologies as well ).

To still reach your goal, you might try to configure it this way:

  1. Add a subdomain with a desired name ( NOT "webmail" - for example: "yourmail" or "email" ) over your Plesk Control Panel.

  2. Add an A - record for the created subdomain at your domain.ltd DNS - as value you will choose the domain-IP ( pls. don't forget to add the record over the Control Panel of your domain registrar as well, not only in your Plesk Control Panel! )

  3. Locate your depending webmail - folder ( for "roundcube" it would be: "/usr/share/psa-roundcube" ) and create a symlink => Example:
    Code:
    ln -s /usr/share/psa-roundcube /var/www/vhosts/domain.ltd/email.domain.ltd

  4. Go back to your Plesk Control Panel and use "Let's encrypt", to secure your new subdomain with a free SSL certificate from Let's encrypt.

  5. At your subdomain - PHP - settings, please add to your existing path at the end "include_path" =>
    Code:
    :/usr/share/psa-roundcube
    and add as well at the end of your existing paths for "open_basedir" =>
    Code:
    :/usr/share/psa-roundcube

  6. Follow the suggestions from https://talk.plesk.com/threads/webmail-question.326784/#post-780422 , but please change
    Code:
    ServerAlias "webmail.<?php echo $VAR->domain->asciiName ?>"
    <?php foreach ($VAR->domain->mailAliases AS $alias): ?>
        ServerAlias  "webmail.<?php echo $alias->asciiName ?>"
    <?php endforeach; ?>
    to
    Code:
    ServerAlias "email.<?php echo $VAR->domain->asciiName ?>"
    <?php foreach ($VAR->domain->mailAliases AS $alias): ?>
        ServerAlias  "email.<?php echo $alias->asciiName ?>"
    <?php endforeach; ?>
    ( or instead of "email", pls. use your choosen subdomain - name, which you just created ). The changes should be made at the CUSTOM templates - folder for:

    domainWebmail.php
    nginxDomainWebmail.php
  7. Pls. don't forget to reconfigure your configuration files with "/usr/local/psa/admin/bin/httpdmng --reconfigure-all"

As you can see, your goal is not that easy to achieve, so you might overthink again your plans and just modify the configuration files, as suggested at: https://talk.plesk.com/threads/securing-webmail-domain-tld.338112/#post-802281
 
Last edited by a moderator:
Hi UFHH01,

No apologies needed! - you're helping me - which I really appreciate.

The main reason I was pursuing the DOMAIN.LTD/anyname over a subdomain (anyname.DOMAIN.LTD) is my belief that Let's Encrypt will only certify DOMAIN.LTD & WWW.DOMAIN.LTD and not subdomains (Your Step#4 fails for me).

I can create an 'A' ssl rating (https://www.ssllabs.com/ssltest/) using Let's Encrypt on https://DOMAIN.LTD and was planning on sharing my results here when I discovered that https://webmail.DOMAIN.LTD uses the default SSL certificate (Tools & Settings | SSL Certificates | Default Certificate) and therefore generates a scary warning message instead of the Let's Encrypt 'all secure here message'.

Adding an additional ssl certificate and using that with a subdomain (anyname.DOMAIN.LTD) and dedicated IP would be a work around but "DOMAIN.LTD/anyname" would have the benefit of a single ssl certification (I personally think the dedicated IP should be used in either case for rDNS to ensure proper email delivery to places like hotmail, outlook, etc,..)

So,... could I do something like this ?

ln -s /usr/share/psa-roundcube /var/www/vhosts/domain.ltd/domain.ltd/pathtowebmail

In your example you created a subdomain, in this case I think the link command would expect a destination that does not exist (i.e I don't create any folder)

The problem seems to be when I get to the php files that don't like the forward slash / as in:
ServerAlias "<? Php echo $ VAR> domain-> asciiName?>/webmail"

Can this be escaped?

HTML allows for escape codes, i.e slash (/) can be replicated using the following in HTML
Code:
&#47;

(I was going to try that but end of line is ; in php so that particular example won't work but you hopefully understand my reasoning here, is something else like this possible?)

In the end if a 2nd cert is required so be it, but it would be nice to figure out a way to allow Let's Encrypt to secure the entire domain including webmail.

Thanks again
Chris
 
Last edited:
Hi Chrisa,

make it easier for you, Chrisa: You are still able to use free certificates from StartSSL ( startssl.com ). The certificates are valid 1 year and for a maximum of 5 hostnames. In your case, I would suggest a single certificate for

www.domain.ltd
mail.domain.ltd
webmail.domain.ltd
other-important-subdomainA.domain.ltd
other-important-subdomainB.domain.ltd

You will be informed several times ( 4 weeks, 2 weeks, 1 week and at the end-day of the certificate end-validation ), so will have enough time, to renew the certificate each year. If you configure your configuration correct, you will get A+ - ratings! :)


No, you can't escape a slash in these configuration files, because you seem to forget, that the generated *.conf - files ( the PHP - files are only templates, used to generate the configuration files!!! ) - ( as for example "/etc/nginx/plesk.conf.d/webmails/DOMAIN.TLD_webmail.conf" ) - will still have the slash as the "server_name" - configuration... which is the root issue here! As I stated before, it is NOT possible, to have a slash inside the server_name - setting - only dots and minus are allowed and possible.
 
Hi UFHH01,
Thank you very much for the help. I will check out StartSSL and update my threads when I have finished testing.

Can I conclude that it is not at all possible to change webmail.domain.com to domain.com/webmail ?

Have a good day.
Chris
 
Hi Chrisa,

it IS possible, but with far more editing of configuration files, templates and modifications to the webmail - software... I really don't recommend that, because Plesk might overwrite your modifications in case of updates/upgrades/patches and you have to start all over again with your changes. In case of any issue/failure/problem ( which might have nothing to do with your modifications and settings ), it is as well more complicated to get to the root cause of your issue, because you will leave the Plesk - standart in several ways, which you have to explain as well to people willing to help you... in total I came to the conclusion, that only "experienced linux administrators" should go this way and that's why I decided not to help with the task to modify the standart webmail - URL.
 
Hi UFHH01,
That sounds like good advice. I don't want to put my customers in a situation where it makes support harder. I will investigate the possibilities you have provided here and update the appropriate threads with the final conclusions so future readers with be able to implement the recommendations in a straight forward manner.

Thanks again for all your help.
Chris
 
Back
Top