Hosting Craft 101

Good news and bad news: there are lots of ways you can host Craft CMS sites.

Craft’s flexibility doesn’t end with content management, and a variety of factors will determine the ideal host for your project. This page covers considerations and terminology to help get you started.

Determining Your Requirements #

Because you can use Craft CMS to build custom sites in many different ways for many different audiences, there’s no one way of hosting a site that could solve for every need at any budget.

Here are some important questions to ask while you’re researching your options:

  • Where is your primary audience located geographically?
  • How many active Craft CMS members or control panel users do you need to support at once?
  • Are you hosting a monolithic, headless, or hybrid front end?
  • What volume of content does Craft CMS need to manage?
  • What sort of traffic do you anticipate having? What strategy do you want to have in place for spikes?
  • How important is quickly and easily scaling your hosting resources?
  • Do you have internal devops resources that can manage and support infrastructure, or do you need to rely on an external provider?
  • Do you anticipate regular, active website development (vs. content management), or longer maintenance periods with occasional scheduled development efforts?

Hosting Terminology #

These are some common terms you’re likely to encounter.

A managed hosting service is one where system uptime and software updates are managed by the hosting company. This does not include Craft CMS software updates, but rather the maintenance for the software stack that supports Craft.

Unmanaged hosting means the provider will make sure you’ve got a healthy machine that’s online, but what you do with the software is entirely up to you. You’ll need to install an operating system and configure the web software stack that supports Craft.

High availability hosting distributes traffic among multiple web servers and has the ability to automatically scale up and down with traffic needs. (Which means it can add and remove resources in real time, all by itself.) This can be similar to fully-managed hosting, but it typically means adding hosting complexity in exchange for a more failure-tolerant website.

Load balanced means hosts that support the addition of load balancers to distribute traffic among multiple web servers. The load balancer is another server that acts just like a maître d' at a restaurant, receiving guests and coordinating where they’re seated and who attends to them.

PaaS stands for Platform as a Service, and it’s a hosting service specifically tailored for developers building PHP applications, often with Craft CMS in mind. (Not every PaaS is PHP-specific, but Craft requires PHP so you’d need a PaaS that meets its requirements.)

VPS stands for virtual private server, which in hosting terms is sort of like an apartment in a larger building; a physical server runs a virtualization layer that divides its resources among isolated sub-machines. You can typically select servers based on what resources they’re allowed—number of CPUs, amount of memory, etc. If a host shares resources effectively, you won’t often notice or be impacted by noisy neighbors.

A dedicated server is an entire physical machine, usually in a datacenter. If a VPS is like renting an apartment, a dedicated server is akin to owning the building. Its resources are fully available to you, all the time.

A CDN or content delivery network can be an important part of how your website performs across the planet. Your web server or servers would typically live behind a CDN which transparently caches pages and content all over the world so each visitor enjoys fast speeds right from their neighborhood rather than having to wait on the full round-trip to wherever your server(s) are located.

A web host may offer a Support SLA formally guaranteeing expectations for support coverage, response times, and general uptime. Hosts without them can still offer great service, but a Support SLA is a formal commitment backed by the business.

Hosting Strategy #

Everyone wants their website to be fast and always available. A sensible hosting strategy balances durability and scale with the human and monetary resources available for management. A large news outlet, for example, will have vastly different hosting needs than a low-traffic personal blog—even though the content editors in each case expect the site to be fast and always online.

There’s no bulletproof hosting strategy, but there are a few common patterns.

A single VPS can be great for smaller sites. It means one virtual machine hosts all the web, database, and cache components Craft needs. It’s simple, low cost, and requires a minimal amount of maintenance if it’s set up well. Managed hosts can set up and maintain that VPS for you. The simplicity is also a limiting factor. The server exists in one location and it’s a single point of failure; if it’s offline, your site likely will be too at some point.

Many small projects are hosted on a single VPS, provisioned by a developer with a service like Laravel Forge, Ploi, or ServerPilot. Those services are also easy to connect with providers like Digital Ocean, Linode, or Vultr.

The next step up from a single VPS is a load-balanced setup: instead of one server you use several of them. A load-balancing server distributes traffic to two or more web servers, so if one gets busy (or goes down), traffic can be sent to a healthy one. Shared resources like the database, uploaded files, and logged-in user information must all be separated out onto additional servers, further adding to the hosting complexity. There are many ways to go about this, whether it’s fully managed by the provider, or your company has its own team that can manage infrastructure on a cloud services provider like AWS, Azure, or Google Cloud.

PaaS offerings are designed to be easy for developers to work with, and privately manage their infrastructure to offer the best performance and simplest “interface.” They’re sort of like fully-managed hosts tailored for an optimal developer experience that balances control with minimal configuration.

Larger projects that don’t have dedicated devops resources tend to work with web hosts that fully manage their servers and offer support from a team that’s familiar with Craft CMS. Additionally, it may be worth contracting an agency to take care of maintenance, software updates, and an another level of support.

What About Shared Hosting? #

We recommend against shared hosting accounts, which are often very low-cost options using cPanel or Plesk for management.

While it’s possible there are exceptions, shared hosting is generally operated by resellers who themselves lease hardware or infrastructure from another provider. It often comes with a high risk of disruptive neighbors, and restrictive options for setup, deployment, or customization—all of which end up spoiling the experience of working with Craft CMS.

Production Tips #

Some best practices apply to any production environment regardless of its hosting setup.

  • Familiarize yourself with deployment best practices and establish a clean process for getting files into production and running updates, including project config and turning off the allowAdminChanges setting.
  • Disable devMode to improve performance and avoid exposing sensitive information in error messages.
  • Enable PHP’s OPcache for optimal performance, and be sure to clear it in your deployment process.
  • Use an email delivery service like Postmark, Mailgun, or SES to ensure transactional email is delivered properly. (The default sendmail fallback may not always be reliable.)
  • Set up an always-running queue so jobs are processed in a timely and efficient manner. Relying on Craft’s default runQueueAutomatically setting could result in queue delays if the control panel is accessed infrequently. Read Robust queue job handling in Craft CMS for more on setting this up.
  • Cache carefully whether it’s with the {% cache %} tag, a CDN, a plugin like Blitz, or a mixture of strategies.
  • Consider image transforms since they’re likely to have the biggest performance impact especially on image-heavy sites. Your web server(s) will need enough resources to handle them efficiently or you may want to offload them to a service like Imgix or your own Lambda function.
  • Use a key/value store for sessions like Redis or DynamoDB so they can be fast, persistent, and scalable unlike the common file system default. See the session component example in the docs.

Applies to Craft CMS 4 and Craft CMS 3.