While CloudPanel is a great panel, it lacked the ability to add domain aliases or parked domains without manually modifying nginx config files.
Even if you modify the vhost server_name with addon domain, it still shares any SSL certificate with the main domain, which is not optimum for our use case, so below is our solution to have the domain be completely independent (Own SSL, own Vhost file) but share the directory of your main domain as an alias while still using the web interface (mostly) to manage the new alias: \
What is required?
-Main site (let's assume main site document path is /home/mainsite/htdocs/mainsite.com and the username and group are "mainuser")
-Secondary site (we're going to create it following the steps in this Gist) \
Steps:
1-Create a new site (Use any template other than reverse proxy, we recommend PHP).
2-Generate the SSL using let's encrypt for your new site like you'd normal do for any website.
3-Once the certificates are generated, open the vhost of your secondary site and replace it with the vhost of the original website, modify the server_name to the new domain name and modify the {{root}} variable to the path of the root of your original website, i.e. /home/mainsite/htdocs/mainsite.com. (Please note the variable is available in 2 different places in file, so replace both).
4-Head to /etc/php/8.2/fpm/pool.d in SSH and modify the pool file for the new alias website replacing the username and usergroup of the secondary website to those of the main site, i.e. "mainuser"
6-Restart PHP-FPM and NGINX and you're good to go! \
Note:
Change "8.2" to your php version.
Alternatively, you can use reverse proxy and the internal IP of the site, i.e. 127.0.0.1:port (you can get the port from the pool.d folder), however, this approach caused issues with my wordpress installation as such, I prefer the above approach.