Best Practices for Hosting Multiple Domains/Subdomains on a Single cPanel Account
Hi cPanel Team,
I’m exploring the best approach to host multiple domains and subdomains under a single cPanel account. My scenario involves a user creating an account through our main domain (mainsite.com). Upon account creation, scripts will automatically set up a database, project folder, and subdomain (e.g., newsite.mainsite.com) routed to that folder. Users can manage their project folders through mainsite.com, where they can add or update PHP classes. Additionally, we plan to offer users the option to switch from newsite.mainsite.com to their own domain (e.g., newsite.com) via API calls if they have the necessary DNS credentials.
Is there a secure way to implement this without creating separate cPanel accounts for each user, while also ensuring that project folders are isolated and protected against upward directory traversal?
Any guidance is greatly appreciated.
-
All add-on and subdomains will be the same cPanel/Linux user, so you can't really isolate them from each other. If you really want to isolate them, they would need to be different cPanel accounts.
0 -
Hey there! The ultimate answer here is how much separate you need on the domains. cPanel allows you to create addon domains under the main account - for example you would have maindomain.com and then you could create addondomain.com on the same cPanel account and host two seperate websites. maindomain.com would be hosted in /home/main/public_html and addondomain.com can be configured at either /home/main/addondomain or /home/main/pulic_html/addondomain.
The "main" cPanel user would be able to access all data for all sites on the account.
If you create additional FTP users, assuming FTP is enabled on your machine, those users would be restricted to the folders you tell them.
Does that help clear things up about the account structure?
0
Please sign in to leave a comment.
Comments
2 comments