Control Web Panel
Developers => CWP API => Topic started by: IonutzIc 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.
-
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
-
Has anyone found a solution for this?
-
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:
DocumentRoot %docroot%
for Nginx root:
root %docroot%;
-
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.
-
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:
DocumentRoot %docroot%
for Nginx root:
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 hostname.conf
and default.tpl
in 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.
-
I have the same problem regarding this, but when the vhost is rebooted, the domain can be accessed
-
I'm facing the same problem
Creation subdomain (with SSL) through API --> the vhost DocumentRoot ends with error path
If I not choose SSL (API), the vhost path is OK
If i create the subdomain from CWP panel, (with SSL) the subdomain vhost path is OK
Example:
With API without SSL: vhost: DocumentRoot /home/<user>/folder1
With API with SSL: vhost: DocumentRoot /folder1
In the first second of API process, the non ssl subdomain vhost creation es OK
Then, after the SSL process, the non ssl subdomain vhost is replaced by the one with path with error
Both vhosts (SSL and Non SSL) end up with wrong path