Mobile app version of vmapp.org
Login or Join
Michele947

: "errors in configuration templates" - how to troubleshoot? My Plesk says "Error: New configuration files for the Apache web server were not created due to the errors in configuration templates:

@Michele947

Posted in: #Plesk

My Plesk says "Error: New configuration files for the Apache web server were not created due to the errors in configuration templates: Can not restart web server:. Search in KB"

The "Webserver Configurations Troubleshooter" extension shows me which files are broken, but it does not show me any details.

I notice that the "Orig. Template" is a php file, e.g. "server.php". This means I can expect there to be log files with the php errors. So, where would I find these logs?

Notes:


The goal of this question is not to figure out my specific problem, but rather the more general question of how to troubleshoot this type of error, so the answer can be useful to more people.
I usually avoid tools like Plesk, and do stuff manually with the cli instead. But this server already has everything configured with Plesk, so now I have to deal with it.


Details

I am adding some snippets from /usr/local/psa/admin/logs/panel.log as suggested by Oleg Neumyvakin, and also some other information. But as said, this added information should not make the question less generic.

Current situation


Changing Plesk configurations of vhosts gives me the "Error: New configuration files for the Apache web server were not created due to the errors in configuration templates: Can not restart web server:. Search in KB"
Restarting apache via cli, sudo service apache2 restart is successful, although it leaves some traces in the apache error.log.
After restarting apache, the website (one of them at least) is available, with a working letsencrypt certificate!
Repeatedly, without intervention, Plesk tries to rebuild the conf files and tells me via email that it failed. This also crashes the website.


UI message

when rebuilding a single file listed on modules/configurations-troubleshooter/index.php/index/list

Error: Can not reconfigure web server configurations: Unable to execute httpdmng: [2016-11-27 14:59:50] ERR [util_exec] proc_close() failed ['/opt/psa/admin/bin/apache_control_adapter' '--restart' '--restart-interval' '0' '--http-port' '80' '--https-port' '443'] with exit code [255]
[2016-11-27 14:59:51] ERR [panel] Apache config (14802550620.55728000) generation failed: Template_Exception: Can not restart web server:
file: /opt/psa/admin/plib/Service/Driver/Web/Server/Apache.php
line: 108
code: 0
Can not restart web server:


From panel.log

/usr/local/psa/admin/logs/panel.log

I see the following being repeated in panel.log:

[2016-11-27 11:26:46] ERR [1] Can not restart web server:
[2016-11-27 11:31:33] ERR [util_exec] proc_close() failed ['/opt/psa/admin/bin/apache_control_adapter' '--restart' '--restart-interval' '0' '--http-port' '80' '--https-port' '443'] with exit code [255]
[2016-11-27 11:31:33] ERR [1] '/opt/psa/admin/bin/apache_control_adapter' '--restart' '--restart-interval' '0' '--http-port' '80' '--https-port' '443' failed with code 255.

stdout:


stderr:

[2016-11-27 11:31:34] ERR [panel] Apache config (14802425710.25667600) generation failed: Template_Exception: Can not restart web server:
file: /opt/psa/admin/plib/Service/Driver/Web/Server/Apache.php
line: 108
code: 0
[2016-11-27 11:31:34] ERR [1] Can not restart web server:


The Apache.php is not a real readable php file. It might be a phar archive or something else.

I also get this, when I try to configure SSL certificates, mostly using "Let's encrypt":

[2016-11-26 20:31:42] ERR [panel] Let's Encrypt SSL certificate installation failed: Failed letsencrypt execution: Saving debug log to /opt/psa/var/modules
/letsencrypt/logs/letsencrypt.log<br />
Obtaining a new certificate<br />
Performing the following challenges:<br />
http-01 challenge for SOME_DOMAIN<br />
http-01 challenge for SOME_DOMAIN<br />
filemng: Error occurred during /bin/mkdir command.<br />
Cleaning up challenges<br />
filemng: Error occurred during /bin/rm command.<br />
filemng: Error occurred during /bin/rm command.<br />
Command &#039;[&#039;/usr/local/psa/admin/bin/filemng&#039;, u&#039;SOME_USER&#039;, &#039;mkdir&#039;, &#039;-p&#039;, u&#039;/var/www/vhosts/SOME_DOMAIN/httpdocs/.well-known/acme-challenge&#039;]&#039; returned non-zero exit status 1<br />
IMPORTANT NOTES:<br />
- If you lose your account credentials, you can recover through<br />
e-mails sent to SOME_EMAIL.<br />
- Your account credentials have been saved in your Certbot<br />
configuration directory at /opt/psa/var/modules/letsencrypt/etc.<br />
You should make a secure backup of this folder now. This<br />
configuration directory will also contain certificates and private<br />
keys obtained by Certbot so making regular backups of this folder<br />
is ideal.


emails

I get emails saying this (and nothing else):

Unable to generate the web server configuration file on the host <ONE_OF_MY_DOMAINS> because of the following errors:

Template_Exception: Can not restart web server:
file: /opt/psa/admin/plib/Service/Driver/Web/Server/Apache.php
line: 108
code: 0

Please resolve the errors in web server configuration templates and generate the file again.


There are multiple domains and vhosts configured, and only one of them generates these emails.

troubleshooting extension

I installed the "Webserver Configurations Troubleshooter" extension in the hope that it would give me more information. Yet all it does is tell me about apache conf files that are marked red with "Can not restart web server". It does not give me information why this happens.

debug output.

After activating the debug settings in /usr/local/psa/admin/conf/panel.ini as suggested by Oleg Neumyvakin, I get a long debug output when rebuilding a conf file:

It contains this stack trace:

[2016-11-28 08:09:57] DEBUG [panel] Template_Exception: Can not restart web server:
file: /opt/psa/admin/plib/Service/Driver/Web/Server/Apache.php
line: 108
code: 0
trace: #0 /opt/psa/admin/plib/Template/Writer/Webserver/Abstract.php(87): Service_Driver_Web_Server_Apache->restart(boolean true) #1 /opt/psa/admin/plib/Template/Configuration/Applier.php(209): Template_Writer_Webserver_Abstract->restart(boolean true) #2 /opt/psa/admin/plib/Template/Configuration/Applier.php(109): Template_Configuration_Applier->_applyConfigurationsToServiceNode(integer '1', array)
#3 /opt/psa/admin/plib/WebServerManager/Adapter/Apache.php(66): Template_Configuration_Applier->applyConfiguration(boolean true)
#4 /opt/psa/admin/plib/WebServerManager/Adapter/Apache.php(350): WebServerManager_Adapter_Apache->sync()
#5 /opt/psa/admin/plib/Service/Driver/Web/Vhost/Apache.php(335): WebServerManager_Adapter_Apache->reconfVhost(string 'SOME_DOMAIN', boolean true, boolean true)
#6 /opt/psa/admin/plib/api-common/Httpdmng.php(271): Service_Driver_Web_Vhost_Apache->updateWebServerConfiguration(string 'SOME_DOMAIN', boolean true)
#7 /opt/psa/admin/plib/api-common/Httpdmng.php(101): Httpdmng->_reconfigureDomains(array)
#8 /opt/psa/admin/sbin/httpdmng(13): Httpdmng->__construct()


It also contains would-be conf file contents, which I will not post here.

Apache error.log

The /var/log/apache2/error.log has some interesting notices. However, these are only from manually restarting it, and they did not prevent apache from being restarted manually via cli.

Some snippets:

[Sun Nov 27 13:36:30.312672 2016] [unique_id:alert] [pid 10383] (EAI 2)Name or service not known: AH01564: unable to find IPv4 address of "rs2****5"

[Sun Nov 27 13:36:30.312995 2016] [unique_id:alert] [pid 10383] AH01565: using low-order bits of IPv6 address as if they were unique

[Sun Nov 27 13:36:32.003989 2016] [ssl:warn] [pid 10384] AH01909: webmail.SOME_DOMAIN:443:0 server certificate does NOT include an ID which matches the server name


Plesk version

Ubuntu 14.04.3 LTS‬
Plesk Onyx 17.0.17 Update #7 , last updated at Nov 27, 2016 12:13 AM
Apache
PHP 5.5.9-1ubuntu4.20


Steps that might have caused this.

Maybe one of the steps below is a "duh, you should not have done this, no wonder it's broken.". But even if so, the main topic should be a generic diagnosis path, that will be useful to other people who might have different problems.

So here is what I did, or what I remember of it:
- I first tried to install letsencrypt certificates via the commandline, in disregard of Plesk.


I then realized I have to do it via Plesk because I don't want to mess with the Plesk-generated Apache conf files.
I had to upgrade Plesk to make it compatible with the "Let's encrypt" extension.
I enabled letsencrypt for some vhosts, and tinkered with certificates here and there.
I also deactivated and re-activated a vhost via the Plesk UI to see if this would change something. It did not.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Michele947

1 Comments

Sorted by latest first Latest Oldest Best

 

@Nimeshi995

The errors should be logged to /usr/local/psa/admin/logs/panel.log

But most of the times it's difficult to get real issue from error message.

Enabling debug in /usr/local/psa/admin/conf/panel.ini provides content of generated temporary configs so you may inspect them:

[debug]
enabled = on

[log]
filter.priority = 7
show.util_exec = on
show.util_exec_io = on


Don't forget to restart sw-engine service like: # service sw-engine restart

It may be:


wrong directives in domain's "Apache & nginx Settings"
selinux, you can disable it for testing with command:# setenforce 0
missed IP addresses, check Tools&Settings>IP addresses>Reread
some web server issues, check for apache and nginx error logs
inconsistency in Plesk database, check for # plesk db repair

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme