Hello everyone,
I’m really impressed with how well-designed MODx is - as a total newbie, it took me only about a half hour to install it on my server yesterday, and everything went without a hitch. Now I want to figure out how to set up separate sites for separate customers, using multiple databases but using a single MODx codebase.
After googling and looking in the forums, I’ve seen many "multi-site" solutions, but many of them are for
Revolution, or they’re for running multiple sites from the same MODx Manager. I’ll be using Evolution, and each site will maintained by a different customer, so
there’s no need to access all the sites from the same MODx Manager. So I hope it’s okay if I post "yet another question about multi-site" here.
What I’m looking for is this: a simple and secure multi-site, multi-database solution using a single codebase / installation of MODx Evolution 1.0.0 - where each site has its own separate directory on the server to hold only those files which are unique for that site (e.g., index.php, uploaded image files, etc.)
I don’t need to be able to access all the sites from a single MODx Manager, and it’s fine to use a separate MySQL database for each site - so the discussions at the links below for example don’t seem to be applicable:
http://www.modxcms.de/multiple-domains-with-modx.html
http://modxcms.com/forums/index.php/topic,38542.0.html
But what I would like to do is use a single codebase / installation for MODx on my server’s hard drive, to allow installing updates or additional snippets for all sites simultaneously.
So I’m thinking that the only thing that needs to be "separate" for each site (aside from the separate MySQL databases) would be a separate directory on the server containing only those files which are specific to that site (eg, index.php, uploaded image files, etc.).
The idea here is that the multi-site capability would be handled by using separate MySQL databases, a carefully planned directory layout on the server’s hard drive, and name-based virtual hosting on the web server - without having to write any PHP snippets for MODx. So MODx doesn’t have to do any work to figure out where each HTTP request is coming from - it’s handled by the web server and the directory structure.
I have used this multi-site, multi-database, single-codebase, directory-layout approach successfully for Drupal, following the instructions here:
http://justinhileman.info/articles/a-more-secure-drupal-multisite-install
and it’s very simple and secure. I’m hoping that someone can point me to a similar solution for MODx Evolution 1.0.0.
I should also mention that instead of using lighttpd, I’m using nginx, which has about the same performance, and uses less memory. The configuration file for nginx is shown here:
http://modxcms.com/forums/index.php/topic,35708.0.html
To set up name-based virtual hosts in nginx, you just create additional ’server’ sections in the nginx.conf file, using a different value for the ’server_name’ variable in each ’server’ section. I believe that something similar is done in lighttpd:
http://www.google.com/search?hl=en&num=100&q=lighttpd+"virtual+hosts"&aq=f&oq=&aqi=
So the main question I have is:
Which files/directories are "site-specific" - and which ones are part of the MODx codebase?
Once that’s answered, I think it should be easy to create additional directories for those files separate from the single, centralized MODx codebase, set up some Linux symlinks (or "aliases" if it’s a Windows server), and configure virtual hosts on the web server - and this would give a simple multi-site, multi-database, single-codebase solution for MODx Evo with little or no modifications to any PHP files.