Symptoms
-
Plesk Premuim Email extension by Kolab is installed and enabled.
-
The following error is displayed when trying to apply the configuration at Domains > example.com > Apache & nginx page:
PLESK_ERROR: Invalid nginx configuration: nginx: [emerg] "server" directive is not allowed here in /etc/nginx/plesk.conf.d/vhosts/example.com.conf:31 nginx: configuration file /etc/nginx/nginx.conf test failed
Unable to use the current nginx configuration file and to rollback to the previous version of the file because they both contain invalid configuration.
Cause
Plesk Premuim Email extension provides invalid mail autodiscovery section to templates during building Nginx virtual host configuration files.
This is extension bug with ID PPPM-14026.
Resolution
Until the bug is fixed, apply the next workaround:
-
Connect to the server via SSH.
-
Backup original
/opt/psa/admin/plib/Template/Processor.php
file:# cp -a /opt/psa/admin/plib/Template/Processor.php{,.bak}
-
Download custom fixed file:
# curl -LO https://support.plesk.com/hc/en-us/article_attachments/15329755898519/Processor.php
-
Replace the original file:
# mv -f ./Processor.php /opt/psa/admin/plib/Template/Processor.php
-
Connect to the server via SSH.
-
Backup original
/usr/local/psa/admin/plib/Template/Processor.php
file:# cp -a /usr/local/psa/admin/plib/Template/Processor.php{,.bak}
-
Download custom fixed file:
# curl -LO https://support.plesk.com/hc/en-us/article_attachments/15329755898519/Processor.php
-
Replace the original file:
# mv -f ./Processor.php /usr/local/psa/admin/plib/Template/Processor.php
- Go to Domains > example.com > Hosting & DNS > Hosting and switch the preferred domain to None.
- Press OK to save changes.
Note: this workaround only for cases when the extension is activated for all domains.
-
Create a custom nginx configuration template, for example on Debian/Ubuntu server:
# cp /opt/psa/admin/conf/templates/default/domain/nginxDomainVirtualHost.php /opt/psa/admin/conf/templates/custom/domain/nginxDomainVirtualHost.php
-
Add
<?php echo "}" ?>
to the custom template in the mail autodiscovery section, so that this:CONFIG_TEXT: <?php if ($VAR->domain->isMailAutodiscoveryEnabled): ?>
<?php echo $VAR->includeTemplate('domain/service/nginxMailAutoConfig.php') ?>
<?php endif ?>turns into this:
CONFIG_TEXT: <?php if ($VAR->domain->isMailAutodiscoveryEnabled): ?>
<?php echo $VAR->includeTemplate('domain/service/nginxMailAutoConfig.php') ?>
<?php echo "}" ?>
<?php endif ?>
Comments
0 comments
Please sign in to leave a comment.