• 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

problem with apache configuration when adding a domain with xml api

Richard Markink

New Pleskian
Getting a error when trying to add a domain using the plesk xml api.

error:
New configuration files for the Apache web server were not created due to the errors in configuration templates: Template processing failed: file = /usr/local/psa/admin/conf/templates/default/domainVhost.php, error = Template_Exception: Empty content was provided for config file /var/www/vhosts/system/elearning.richardmarkink.nl/conf/httpd.conf file: /usr/local/psa/admin/plib/Template/Writer/Webserver/Abstract.php line: 47 code: 0. Detailed error descriptions were sent to you by email. Please resolve the issues and click here to generate broken configuration files once again or here to generate all configuration files.

the website is added but there are no apache config files.

the xml code is used:
<packet>
<site>
<add>
<gen_setup>
<name>elearning.richardmarkink.nl</name>
<webspace-id>4</webspace-id>
</gen_setup>
<hosting>
<vrt_hst>
<property>
<name>fp</name>
<value>false</value>
</property>
<property>
<name>fp_auth</name>
<value>false</value>
</property>
<property>
<name>fp_admin_login</name>
<value/>
</property>
<property>
<name>fp_admin_password</name>
<value/>
</property>
<property>
<name>www_root</name>
<value>/elearning.coursenet.nl</value>
</property>
</vrt_hst>
</hosting>
</add>
</site>
</packet>

can someone give me a solution for this ? or what am i doing wrong ?
using plesk 12.5 on centos
 
I have tried your XML code on my test Plesk 12.5 server and added this domain without any problems:

POST https://ppu12-5.demo.pp.plesk.ru:8443/enterprise/control/agent.php

Request headers:
HTTP_AUTH_LOGIN: admin
HTTP_PRETTY_PRINT: TRUE
HTTP_VALIDATE_RESPONSE: TRUE
HTTP_AUTH_PASSWD: setup

Request body:
<packet>
<site>
<add>
<gen_setup>
<name>elearning.richardmarkink.nl</name>
<webspace-id>1</webspace-id>
</gen_setup>
<hosting>
<vrt_hst>
<property>
<name>fp</name>
<value>false</value>
</property>
<property>
<name>fp_auth</name>
<value>false</value>
</property>
<property>
<name>fp_admin_login</name>
<value/>
</property>
<property>
<name>fp_admin_password</name>
<value/>
</property>
<property>
<name>www_root</name>
<value>/elearning.coursenet.nl</value>
</property>
</vrt_hst>
</hosting>
</add>
</site>
</packet>

Response status code: 200

Additional headers:

Response body:
<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.7.0">
<site>
<add>
<result>
<status>ok</status>
<id>4</id>
<guid>233c4543-6b0b-4afc-83f1-b9207eb6967e</guid>
</result>
</add>
</site>
</packet>

(changed only webspace-id to 1 because I have no with id 4).
Maybe you have initial config issues before adding this domain? Try to repair webserver settings with

# plesk repair web

and run this API request again.
 
tested some things today:

When I use a web plugin to send curl post request to my server there is no problem and it is working fine, but when i use the php API client as find on the github the error occeur and a 503 page is shown.
what can be the problem?
 
Back
Top