Welcome Guest, Not a member yet? Register   Sign In
Multisite CI installations - HOW TO
#1

[eluser]developer10[/eluser]
Hello there,

I want to do what the topci says but dont know where to start. I read some topics here about it but still dont get it.

I want to be able to put a single CI installation on my server and then multiplicate application folder, upload several applications and
have http://example.com pointing to application1, http://example2.com pointing to application2 etc.

All of these should work independently whenever someone visits one of them.

So, is it possible and if so, how can it be done?
#2

[eluser]John_Betong[/eluser]
 

http://johns-jokes.com/_menu.php

Checkout the above web page and follow the top right hand link for further details.

The _menu.php was designed for my LOCALHOST and most of the links do not work but no doubt you will get the general idea.

 

 

 
edit: spelling
#3

[eluser]developer10[/eluser]
Before i check all this, please tell me if i'll be able to have those domains working independetly and at any time (consider CI needs to know which app is currently default).
#4

[eluser]John_Betong[/eluser]
[quote author="cold_fusion" date="1272223190"]Before i check all this, please tell me if i'll be able to have those domains working independetly and at any time (consider CI needs to know which app is currently default).[/quote]
 
I set the menu so that each program can be run separately on the same LOCALHOST or SERVER. As you can see the menu is in three sections, left is the sub-domain applications. middle is the CodeIgniter applications and right is the stand-alone PHP applications.

The center CodeIgniter applications can only be run individually in the same browser because the application folder is set using a PHP $_SESSION variable.

Another application can be run at the same time but it must be in a different browser to avoid $_SESSION conflicts.

 
 
 
#5

[eluser]Zeeshan Rasool[/eluser]
You can handle these applications with single CI installation but on same server. Yuo can either keep CI installation separate or keep application folders inside CI installation. This makes it independent and you can set any application as default in index.php
#6

[eluser]developer10[/eluser]
[quote author="Zeeshan Rasool" date="1272283408"]You can handle these applications with single CI installation but on same server. Yuo can either keep CI installation separate or keep application folders inside CI installation. This makes it independent and you can set any application as default in index.php[/quote]

i wonder if i would be able to have all the application "default" at the same time. what does this mean?
Any app at any given time should be accessible for a visitor - without that i really dont see the point of
having multisite CI installation on a live server.

Of course, i'm already using multisite installation on my localhost, and am just switching between apps
when developing.

I wonder if a codebase could be kept in a site's root, and application folders be kept in a subdomain's
folders (which path is "rootfolder/subdomain") and have no actual default app - any of them should work
when accessed.

Is this possible?
#7

[eluser]Zeeshan Rasool[/eluser]
Why you want to do that? i mean your app folders will be accessed by their domain name. However you can put your application folders out side CI installation any where (not checked on sub domain). I my self use to keep application folders out side CI so that i can add my new application in index.php easily. In your side, you can easily move to different applications if you put some checks in index.php with a single flag type param to make an application default and each time you have to update it to switching b/w applications.
#8

[eluser]developer10[/eluser]
[quote author="Zeeshan Rasool" date="1272290993"]Why you want to do that? i mean your app folders will be accessed by their domain name. However you can put your application folders out side CI installation any where (not checked on sub domain). I my self use to keep application folders out side CI so that i can add my new application in index.php easily. In your side, you can easily move to different applications if you put some checks in index.php with a single flag type param to make an application default and each time you have to update it to switching b/w applications.[/quote]

why? well, i'd like to host lets say 4 sites inside one hosting account.

Let's say example1.com will be pointing to sub1.mysite.com
example2.com will be pointing to sub2.mysite.com
example3.com will be pointing to sub3.mysite.com
example4.com will be pointing to sub4.mysite.com

(each domain would be set to go to the desired subdomain on the registrar).

I only have 1GB of my hosting package and only 140 mb left, so i dont want to:

- waste my disk space
- update CI individually (i update only one CI installation instead)
- i do want to share some resources (libraries, etc.)
from the main codebase

I think those are good enough reasons for having this arranged in such way, don't you?
#9

[eluser]paulc010[/eluser]
I'm confused. Maybe it would be better if you described the directory structure? If you're using cpanel with the usual "add-on" domains you could have the directories for each site in public_html:

Code:
public_html/
  |
  |-site1/
  |
  |-site2/
  |
  |-site3/

So the document root for sub1.mysite.com is public_html/site1

If that's the case then you install the codeigniter system in public_html, and place the applications, main index.php file and all your asssets one in each subdirectory. This gives:

Code:
public_html/
  |
  |-system/
  |
  |-site1/
    |
    |-application1
  |
  |-site2/
    |
    |-application2
  |
  |-site3/
    |
    |-application3

Now you have a single copy of the codeigniter system, and one application in each "site" folder. In the index.php in each site subdirectory you just need to set:

$system_folder = "/full/path/to/public_html/system";
$application_folder = "applicationX";

Note that you can't share libraries between the applications this way unless you place them in the public_html/system/libraries directory and so on. You could try to go further and move the common application files into a directory in public_html (above the subdomain directories) and then use hard links to allow each application to use the same directories for libraries, plugins etc. but obviously not config, constrollers, views etc.

Is this what you mean?

Paul
EDIT: thinking on it using linked directories to "remap" common application folders would likely cause some real headaches.
#10

[eluser]Zeeshan Rasool[/eluser]
[quote author="cold_fusion" date="1272310529"]
I only have 1GB of my hosting package and only 140 mb left, so i dont want to:

- waste my disk space
- update CI individually (i update only one CI installation instead)
- i do want to share some resources (libraries, etc.)
from the main codebase

I think those are good enough reasons for having this arranged in such way, don't you?[/quote]

I think, You can do this, but not confirmed about calling CI classes on sub-domains. Make it a try. Put your CI installation on domain an use absolute paths to get CI system folder.
for this put separate index.php file in each sub-domains with application folder and give absolute static path to system folder.

sub2.mysite.com = index.php+application // set sstem folder path with absolute path
sub3.mysite.com = index.php+application // set sstem folder path with absolute path
sub4.mysite.com = index.php+application // set sstem folder path with absolute path




Theme © iAndrew 2016 - Forum software by © MyBB