Welcome Guest, Not a member yet? Register   Sign In
CPanel shared hosting with multiple domains
#1

I read the information on using CI4 with CPanel but I have a bit of an issue. I have several domains within my one CPanel, so my structure works as below
  • /php
  • /public_ftp
  • /public_html
  • /main-domain
  • /ssl
but, then I have the following within the /public_html/ directory:
  • /public_html/domain1
  • /public_html/domain2
  • /public_html/domain3
The very first domain I ever setup, has all the stuff for it within the /public_html/ folder, but it does have the folder outside the /public_html/ that is empty. This is not the domain I am looking to deploy to unfortunately. Is it possible to deploy to one of the domain directories inside the /public_html/ directory, because the only alternative I would have if this is not possible would be to get a second account and move that domain to that second account by itself, but that would incur additional hosting cost monthly, and I'm hoping to deploy multiple CI4 sites, but I can't afford to pay monthly hosting fees for each site I'm hoping to deploy. Any suggestions welcome because I have 14 or 15 websites I'd like to use CI4 to develop.
Reply
#2

(This post was last modified: 02-10-2025, 06:42 AM by grimpirate.)

You can test how domains work on your hosting provider by creating a subdomain. Usually the cpanel will have an option for creating it where you can specify which will be its public_html (and its respective name) directory. You could then place your codeigniter directories within/alongside it and place your vendor/, composer.json and composer.lck one directory higher, producing the following structure:

/php
/public_ftp
/public_html
/main-domain
/ssl
/subdomain.yourdomain.com/app
/subdomain.yourdomain.com/public
/subdomain.yourdomain.com/writable
/subdomain.yourdomain.com/spark
/subdomain.yourdomain.com/.env
/vendor
/composer.json
/composer.lck

More information in the docs:  The directory structure you have employed leads me to believe the sites are not separate domains, rather they are subdirectories inside your main domain. So you could see all of them in a list if you accessed http://main-domain/ and you could travel to each by doing http://main-domain/domain1, http://main-domain/domain2, etc. Not sure what your level of server admin is, but you may want to brush up on how to configure your hosting. Of course that may also be how you want your sites set up, but that seems suspect.
Reply
#3

That is, to be perfectly honest, an excellent theory! I'm going to contact my website hosting provider and run that by him to get his feedback! Thank you very much GrimPirate!!
Reply
#4

quote : "an excellent theory! " well i have Ci4 running live . The only directoires within a sub directory needed are : app, writable, public and vendor. So on my main hosting i have have up to 20 sub domains. A fully fledged domain name is linked to each sub domain. On my hosting first I have to "manage" domains linked to my account; then use on cPanel "add on domain" on mine that also creates a subdomain. I make the root document public . It all works fine
CMS CI4 A CMS system, runs out of the box written on top of CI4
Arch Book  CodeIgniter4 on Apache(pages 92-114) 
Reply
#5

@captain-sensible Your setup would probably work just as well if you moved the vendor directory out of the individual subdomains so that they share it as a common path. The most tangible benefit of keeping your vendor directory inside the subdomain is that you can upgrade each subdomain individually. You may have some reason for doing this but I've found it more productive to upgrade the vendor directory once and then go across each subdomain and make whichever changes are necessary, respectively, to each app.
Reply
#6

@grimpirate good idea , im slow to catch on . Seems like yesterday i was using punched cards and Fortran IV lol
CMS CI4 A CMS system, runs out of the box written on top of CI4
Arch Book  CodeIgniter4 on Apache(pages 92-114) 
Reply
#7

@captain-sensible Always happy to help a fellow Archer.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB