We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 51105
    • 2 Posts
    Hello all!

    I'm brand new to MODX and everything I've seen so far is very promising -- I am having a little trouble finding any existing advice or information about how people approach hosting many MODX sites on the same server. Here's my dilemma:

    We do a lot of websites for small, non-tech-savvy clients who simply want a website they can add/edit content to and usually some sort of blog. We've been using Wordpress for this and I am sick and tired of how slow, bloated, and (in 99% of cases) way overkill it is. Most of users do not care one bit about most of Wordpress features. I've been dreaming of a CMS where I, as the dev, can take FULL control over the layout and templating, and give the end user NO control over anything but content itself -- our users prefer to focus on nothing but content and I prefer to give users as little ability to mess stuff up as possible. From what I've seen, I think MODX fits the bill and in my limited experimentation so far I am very impressed with the simplicity of creating templates and so forth.

    On to my question. We're ready to start offering our users hosting, because that's another headache we are tired of. We'd like to be able to build and host websites for our clients and hand them a simple, ready-to-go, nothing-to-worry-about interface for managing their content. Now, it seems like I'd have no problem hosting several MODX sites on the same server with multiple installs. I would like to keep the majority of the templates in centrally located static files that can be reused for multiple sites -- this also seems doable.

    However, what I'm stuck on, is whether an experienced MODX developer would approach this scenario by creating a fresh MODX installation for every client, with its own set of core MODX files duplicated on the server, or if this sort of setup is better tackled with a single MODX installation? If I only have one instance of the MODX core installed, can I offer many completely unrelated users with their own websites completely encapsulated access to the CMS? Can I have subdirectories with their own CSS and other assets all pointing to the same MODX core?

    From a DB perspective, should I expect to create a new database for each client or can MODX effectively use a single (MySQL for instance) database and separate each users' websites? If I went with the latter, how easy would it be to export an individual site if a user wants to switch hosting?

    I know these are a lot of questions -- I'm so close to pulling the trigger on MODX, I'm just trying to wrap my head around the requirements and how I would begin structuring all this. Thanks in advance!

    This question has been answered by BobRay. See the first response.

    • discuss.answer
      • 3749
      • 24,544 Posts
      One way of handling this is with multiple contexts in one MODX install, but personally I wouldn't recommend it because it involves extra work to set up the contexts and keep users from seeing the other sites. There are also potential conflicts with chunk names used in the various sites. Editing user info also gets more cumbersome and the Manager will become slower and slower as you add sites. One advantage is that all sites can share the same snippets and chunks, and upgrading is easier, but they'll also share the plugins, so all plugins will run for all sites (whether you want them for that site or not) unless you customize them to check the context before executing.

      I think I would give every site its own database and it's own folder under public_html if you can afford the disk space.

      You can let them share the core, which you can put above the web root for security. This means editing the three config.core.php files (MODX root, manager, and connectors directories) to tell MODX where the core is. The down side of this is that when you upgrade MODX, you have to upgrade all the sites individually at the same time so the stuff in the database will match the version of the core. This could get really tedious if you have a lot of sites and it's harder to let a user migrate to a different server.

      You also have the option to have separate sites that all use the same database by using a different table prefix for each site, but again, this makes migration to another server somewhat more complicated. This gives you one big database as opposed to many smaller databases. Overall, I don't think you gain much by it and it adds complexity.

      All-in-all, I think it's much easier to manage things if every site has its own separate MODX install, in its own directory, with its own database. It wastes server resources, but the sites and the Manager are faster, the Manager is easier to customize, they can be updated individually whenever the mood strikes you (no need to synchronize the versions), and they're much easier to migrate to another server.

      Other users may disagree with me on this.

      BTW, NewsPublisher lets users create and edit resources (pages) in the front end. You can easily limit the fields shown and you can control where the resources are created and which users can create and/or edit them. You also have the option to show an "Edit" button on each page (or selected pages) to specified, logged-in users. Clicking on the button will take them directly to the NewsPublisher page to edit that page. Using NewsPublisher lets you keep the user from having to log in to the Manager and gets you out of customizing the Manager for them.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 18373 ☆ A M B ☆
        • 3,141 Posts
        Mark Hamstra Reply #3, 11 years ago
        Quote from: BobRay at Sep 17, 2015, 10:42 PM
        All-in-all, I think it's much easier to manage things if every site has its own separate MODX install, in its own directory, with its own database. It wastes server resources, but the sites and the Manager are faster, the Manager is easier to customize, they can be updated individually whenever the mood strikes you (no need to synchronize the versions), and they're much easier to migrate to another server.

        I'm with Bob there - while a single server/server user and keeping it all in one install can be tempting in terms of upgrades and setting things up once, for the long term keeping them separate sounds like a better strategy.

        One notable exception to that is when there is one client/entity in charge of a number of websites. For example my family breeds alpacas, and for that we have 4 different sites related to that all in the same install. They then get the benefit of sharing a login to manage them all, and sharing the same templates where applicable.
          Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

          Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
          • 51105
          • 2 Posts
          Thank you both for your detailed and thoughtful responses. In the interim I've set up my first MODX installation on a VPS which went just perfectly smoothly. I've already discovered how easy it is to set up a central store for reusable templates (which was my only concern with having a separate install per site) -- that way I can get each new site to share the same set of basic templates and add custom ones per site as needed.

          Quote from: BobRay at Sep 17, 2015, 10:42 PM

          All-in-all, I think it's much easier to manage things if every site has its own separate MODX install, in its own directory, with its own database. It wastes server resources, but the sites and the Manager are faster, the Manager is easier to customize, they can be updated individually whenever the mood strikes you (no need to synchronize the versions), and they're much easier to migrate to another server.

          I'll definitely go this route -- migration to another server is a key feature for us, so that we can provide the client with a copy of just their site which can be easily migrated. It seems like it will be fairly easy to set up a basic installation with all of the settings and user policies we'd like for a fresh install and use that for each new client.

          Quote from: markh at Sep 20, 2015, 03:25 AM
          One notable exception to that is when there is one client/entity in charge of a number of websites. For example my family breeds alpacas, and for that we have 4 different sites related to that all in the same install. They then get the benefit of sharing a login to manage them all, and sharing the same templates where applicable.

          That makes sense. It seems like with our setup we can pretty easily be flexible enough to host both individual installs per site and also offer a "multi-site" admin on a per case basis if a client wants to manage a chain of websites in this fashion.

          Again, thanks for your advice. This stuff is pretty exciting, I'm already forgetting about WordPress!