Author Topic: CWP api admindomains add subdomain  (Read 8496 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
CWP api admindomains add subdomain
« on: April 14, 2020, 07:53:47 AM »
I`m trying to add a subdomain to an existing user using the api /v1/admindomains post action from php.
everything seams to work fine but my apache Vhost is generated with the relative path.

so when i call the api with "path"=>'/public_html/test" my test subdomain gets generated, ssl is generated, folder /home/testuser/public_html/test is generated, the cwp db is updated ok, in the cwp admin > list subdomains the path is /home/testuser/public_html/test, but in my vhost DocumentRoot is "/public_html/test".

If i pass the entire path "/home/testuser/public_html/test" the new folder is created in "/home/testuser/home/testuser/public_html/test"

If I add it from the admin interface the paths are all ok.
I checked the vhosts template is the same for both api and web interface, "DocumentRoot %docroot%".

Any ideas ?

Thank you.

Offline
*
Re: CWP api admindomains add subdomain
« Reply #1 on: February 10, 2021, 05:50:24 PM »
I am facing the same issue on my end whenever a subdomain is created from api subdomain shows following error:

Not Found

The requested URL / was not found on this server.

when subdomain is created with API its Document root in vhost is set /public_html/subdomain/sub.domain.com while it should be /home/user/public_html/subdomains/sub.domain.com .. and upon restarting apache I  get following warning: AH00112: Warning: DocumentRoot [/public_html/subdomains/testing/] does not exist

Offline
*
Re: CWP api admindomains add subdomain
« Reply #2 on: August 03, 2021, 07:51:50 PM »
Has anyone found a solution for this?

Offline
**
Re: CWP api admindomains add subdomain
« Reply #3 on: September 06, 2021, 06:05:59 PM »
Did you modify the apache/nginx templates using the control panel or manually over SSH ?

More about the webtemplates you can find here:
http://wiki.centos-webpanel.com/webservers-vhost-templates

Just make sure sure the directive DocumentRoot inside the apache templates looks like:

Code: [Select]
DocumentRoot %docroot%
for Nginx root:

Code: [Select]
root %docroot%;

Offline
*
Re: CWP api admindomains add subdomain
« Reply #4 on: October 20, 2021, 11:37:05 AM »
Has anyone found a solution for this?
Nop, i am still correcting those files manually. I opened up support ticket and got response after 4 - 5 days. I failed to respond on time after that cwp team closed my ticket and never bothered to read it again after reopened the ticket with php test code.

Offline
*
Re: CWP api admindomains add subdomain
« Reply #5 on: October 20, 2021, 11:42:20 AM »
Did you modify the apache/nginx templates using the control panel or manually over SSH ?

More about the webtemplates you can find here:
http://wiki.centos-webpanel.com/webservers-vhost-templates

Just make sure sure the directive DocumentRoot inside the apache templates looks like:

Code: [Select]
DocumentRoot %docroot%
for Nginx root:

Code: [Select]
root %docroot%;

I thought about modifying the template files but upon looking at new interface I wasn't able to make head or tail of it. So I decided to leave it alone as I can't experiment on production servers unless I am sure about what I am doing.

Update
I just checked
Code: [Select]
hostname.conf and
Code: [Select]
default.tpl in
Code: [Select]
WebServer Settings > WebServers Template Editor > Httpd

There is nothing with templates. The issue is %docroot% variable is being passed incorrect value or no value at all when subdomain is created via API. I forgot to mention this but I double checked these files and I was trying to find my way around that's when I realized I should not play with these template files and wait for CWP team to look in this matter.
« Last Edit: October 20, 2021, 12:38:31 PM by mehroz »

Offline
*
Re: CWP api admindomains add subdomain
« Reply #6 on: October 31, 2021, 09:07:11 AM »
I have the same problem regarding this, but when the vhost is rebooted, the domain can be accessed