Posted 10 January 2012 - 03:50 PM
At the moment the site structure is like:
A multi-site setup could be:
Depending on the entry-domain, the config from the domain gets loaded. So http://processwire.com would load processwire.com/config.php and http://talk.processwire.com would load talk.proceswire.com/config.php.
If you need a module for just one site, stick it in the domain/modules folder, same for the templates and assets.
Any thoughts about this?
Posted 10 January 2012 - 04:14 PM
But lets say you've got just one hosting account and want to run multiple sites at the same web root. In that case you need to adjust the config according to the hostname. This is easy to do. Edit your /index.php file and locate this line:
$siteDir = "site";
...and add this after it:
if(strpos($_SERVER['HTTP_HOST'], 'other-site.com') !== false) $siteDir = 'other-site';
Admittedly I haven't had a need to try it just yet, but that's the way it's meant to work. So in the above scenario, if someone access your site at 'other-site.com', then it uses the 'other-site' directory rather than the 'site' directory.
Posted 11 January 2012 - 03:37 PM
For that type of multi-site setup, the way that I do it, and I think others are, is to just use symbolic links. So all the sites share the same /wire/ directory, but each have their own /site/ directory.
I'm intrigued by this - can you go into more detail? It sounds great, but I can't quite visualise how it works from a domain name point of view or a technical point of view.
Posted 11 January 2012 - 03:46 PM
/ /www/ /www/web.com/ ./index.php ./site/ ./wire/ - symlinked /www/example.com/ ./index.php ./site/ ./wire/ - symlinked /www/another-domain.com/ ./index.php ./site/ ./wire/ - symlinked /non-accessible/ (or any other server dir, possibly out of your publicly accessible directories) ./wire/ - physical directory, for all domains
Posted 11 January 2012 - 03:56 PM
/non-accessible/ ./P21dev/wire/ ./P21stable/wire/ ./P21latest/wire/ ./modules/modulename/
how it works from a domain name point of view
We took the "automagic" little further: we have used Apache virtualdocumentroot (http://httpd.apache....hosts/mass.html) and some simple mod_rewrite to automatically serve sites from right directory. So no need to manage vhosts etc when adding new sites. We also use our dev domain (pwire.fi) to serve sites before dns-changes have been made. When I create site www.domain.com then it is right away accessible from www.domain.com.pwire.fi.
Posted 12 January 2012 - 12:34 PM
Each alternate /site-domain/ directory should be configured to use a different database. So the best bet is to do one of the following:
1. Copy the entire /site/ directory to a new /site-domain/ directory. Edit /site/config.php and supply new database information (seen at the bottom). Export your main PW site database, and import it to the new DB used by your alternate domain.
2. OR: install more copies of PW on your server (like in directories). After running through the installer, move their site/ directory to the /site-domain/ directory in the main PW install, and then delete any other installed copies as you don't need them anymore.
Posted 17 January 2012 - 12:58 PM
For testing purposes I copied all the contents of the /site/ directory from a working PW install on the same server to /site-testing/ on the root of my main PW at mydomain.com. Then I moved the index.config.php file to the same place, and replaced the examples by:
'www.mydomain.com' => 'site-testing'
I'm still getting my main website when I access www.mydomain.com, shouldn't it be already the other site?
Posted 17 January 2012 - 01:21 PM
Make sure that your /index.php and /.htaccess files are both brand new from PW 2.2.
Next, I suggesting adding both 'www.mydomain.com' and 'mydomain.com' to both go to /site-testing/.
Lastly, if /site-testing/ is just a copy of your /site/ dir, then make sure you've updated something in your /site/templates/ to reflect that, so that you can tell the difference. For instance, have /site-testing/home.php have something like "echo "<h1>Site-testing</h1>";
Posted 17 January 2012 - 01:27 PM
Posted 17 January 2012 - 02:15 PM
edit: is it possible that the website gets slower with the new process? I have a ubuntu server with each site in a virtual server, I pointed the domain to the new folder on index.config.php, and removed it from "sites enabled" in apache.
edit2: and restarted the server
Posted 17 January 2012 - 04:09 PM
is it possible that the website gets slower with the new process?
There shouldn't be any overhead with using the multisite feature. All it's doing is checking $_SERVER['HTTP_HOST'] to determine what /site/ directory it should use, and that doesn't represent any overhead.
I have a ubuntu server with each site in a virtual server, I pointed the domain to the new folder on index.config.php, and removed it from "sites enabled" in apache. edit2: and restarted the server
I'm not sure I understand. Are you saying that something is not working how it should, or that restarting the server fixed it?
Posted 17 January 2012 - 05:36 PM
I restarted right after all the other things, the problem came after that.
Anyway, I did some test and I don't notice any difference now, maybe it happened because the images were already cached in the browser when I tried the second time.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users