Adding subdomains pointing to the existing directories in application or external site
I was surprised to know that that you cannot add a subdomain and point to your existing directories. even pointing to other domains.This features was there in cpanel from beginning and it is quite useful. Especially this features helps to server make the site much more faster in magento by making subdomains for stating content like media, js etc and configure in magento application. I had this setup in my earlier hosting making the site to load ~1 sec. I have moved the site to cloudways now it loads ~4 seconds
This would be useful for many non-magento sites as well.
AdminCloudways (Admin, Cloudways) commented
At the moment, support for additional vhost for the sub-domains or pointing to separate webroots is not available.
However a solution for your scenario would be to add 'Additonal domains' through Cloudways panel and instead using separate webroots, specifiy the static/media paths in URL with additonal domains in Magento Admin
For e.g if you have additional domains static.yourdomain.com and media.yourdomain.com for static and media paths respectively.
First you can add them as additional domains through Cloudways Panel, this would map the additional domains/sub-domain to your application
Then in Magento panel: stores -> configuration -> web -> Base URL or Base URL Secure (in case your setup is on HTTPs) for magento 2.X, set path in following manner
static.yourdomain.com/pub/static/ (for static)
media.yourdomain.com/pub/media/ (for media)
Setting this way enables you to gain the performance, as having the additional domains/sub-domains will increase the number of parallel downloads that the browser can perform.
Hope that answer your question
To read how you can add additional domains/sub-domains please follow this KB: https://support.cloudways.com/what-is-the-difference-between-primary-domain-and-additional-domains/
Please implement this.
In magento 2, we can insert subdomain for static and media url and use cpanel to point the the subdomain to the pub/static and pub/media folder.
Now with cloudways, we cannot do that anymore.
Agreed. This should be a thing.