Unable to generate Apache configuration files: Template_Exception: Can not restart web server

Follow

Comments

14 comments

  • Avatar
    Martin Blaha

    That did it for me, thanks.

    After performing dist-upgrade on my server running Ubuntu 14.04.5 (Plesk Onyx v17.5.3_build1705170317.16 os_Ubuntu 14.04).

       
  • Avatar
    tomaz

    I have similar issue on Centos...

  • Avatar
    Ivan Postnikov

    Hello @tomaz, could you, please, let me know the exact error message you get?

    This should help to suggest you a solution.

    This bug is registered as specific for Ubuntu 14.04 with systemd or Debian 8.

  • Avatar
    Jorge

    Similar problem here on Centos, after plesk update itself on Aug/06:

    "Can not restart web server: INFO: [Mon Aug 6 12:52:11 -03 2018]: Service: httpd, Action: stop Trying to stop service httpd... WARNING! Some problems are found during attempt to status service pc-remote - control script doesn't exist or isn't executable(see log file: /var/log/plesk/rc_actions.log) Continue... STOP ...."  (very long text)

     

  • Avatar
    Peter Peterson (Edited )

    Hi, 

    I updated fist my ubuntu server from version 14.04 to 16.04. After that I used the installer to upgrade plesk from version 12.5 to Plesk Onyx 17.8.11 Update #16.

    Plesk can't start the apache2 service anymore through apache_control_adapter. There is also a Template Exception but I have no clue where to Search.

    httpdmng --reconfigure-domains fails due to the following exception:

    Details: [2018-08-08 14:14:09.606] 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]
    [2018-08-08 14:14:11.739] ERR [panel] Apache config (15337302900.32783500) generation failed: Template_Exception: Can not restart web server:
    file: /opt/psa/admin/plib/Service/Driver/Web/Server/Apache.php
    line: 109
    code: 0
    Can not restart web server:

    Starting or restarting the server with service apache2 start works.

    Thanks you, 

    Peter

  • Avatar
    Alexandr Redikultsev

    Hi @Jorge!

    The resolution in this article is specific for dist-upgrade issues, so the cause of the error that you faced should be different. As the issue occurs after the update, I suggest re-applying the updates:

    # plesk installer update --repatch

    And then executing the following command:

    # plesk repair installation

    In case it will not help, then submit a full request to technical support.

  • Avatar
    Alexandr Redikultsev

    Hi @Peter Peterson!

     

    Could you provide me with the content of /opt/psa/admin/sbin/pleskrc? Also, execute the following command in order to re-read server components and try restart via apache_control_adapter again:

    # plesk sbin packagemng -sdf

  • Avatar
    Peter Peterson

    Hi @Alexandr Shadrin, 

     

    the plesk sbin packagemng -sdf didnt help. the content of the desired folder is: https://pastebin.com/jmjDHzcf

     

    Thank you, 

    Peter

  • Avatar
    Jorge

    Hi @Alexandr Shadrin 
    Thank you so much, it worked!

  • Avatar
    Alexandr Redikultsev (Edited )

    Hi again, @Peter Peterson! 

    Script looks fine (in case systemd is used), so I suggest troubleshooting the issue further in the following manner:

    1. Try restarting apache with various methods, for example:

    # service apache2 restart
    # systemctl restart apache2
    # /etc/init.d/apache2 restart
    # /usr/sbin/invoke-rc.d apache2 restart

    Maybe some of them will finish in 0 seconds, then the cause will be the fact that service is disabled. Maybe you will need to run the following command in order to make apache_control_adapter work:

    # update-rc.d mysql enable

  • Avatar
    Alexandr Redikultsev

    Hi @Jorge!

    Glad I can help!

  • Avatar
    Eros Bruno

    Hello, I have a similar problem on my VPS.
    plesk shows the error "The new configuration files for the Apache web server were not created due to errors in the configuration templates"
    I followed what was written before, but I did not solve anything. Another error is shown to me when I run the command via ssh: "plesk repair web -server" which fails with the error: "Template_Exception: Can not restart web server:
    file: /opt/psa/admin/plib/Service/Driver/Web/Server/Apache.php
    line: 109
    code: 0
    "

    Ultimately, the apache web server does not boot in any way.
    Can someone help me please? I do not know what to do...

  • Avatar
    Taras Ermoshin

    Hi @Eros Bruno !

    If dist-upgrade takes place, ensure that it is fully completed. Also, check if Apache service is enabled for starting on system startup (you can use this article for reference).

    If the issue is not resolved after that, consider searching for the similar articles in our Help Center (as this one covers pretty edge case - bug on specific OSs) or submitting a support request.

  • Avatar
    Emanuele Feliziani

    @Eros Bruno I was having your exact same issue. In the end, I followed this article, which lead me here. This step is important as well, otherwise you might lose your config at the next reboot+reconfig.

    This would have saved me hours of investigating. Hope it helps.

Please sign in to leave a comment.

Have more questions? Submit a request