How to Install Craft CMS on a VPS

Craft CMS is a developer-friendly, content-first CMS known for its flexible content modeling and clean administrative interface — popular for custom-designed sites where a rigid theme system would be limiting.

Prerequisites

  • Ubuntu 22.04/24.04 VPS: 2 vCPU, 2 GB RAM minimum
  • Nginx, PHP 8.2+, MySQL/MariaDB or PostgreSQL
  • Composer

Step 1 — Install Required PHP Extensions

sudo apt install php8.2-mbstring php8.2-curl php8.2-gd php8.2-mysql php8.2-intl php8.2-zip -y

Step 2 — Create the Database

sudo mysql
CREATE DATABASE craftcms;
CREATE USER 'craft'@'localhost' IDENTIFIED BY 'CHANGE_ME_STRONG_PASSWORD';
GRANT ALL PRIVILEGES ON craftcms.* TO 'craft'@'localhost';
FLUSH PRIVILEGES;

Step 3 — Install Craft via Composer

composer create-project craftcms/craft /var/www/craft

Step 4 — Run the Setup Command

cd /var/www/craft
php craft setup

Interactive prompts configure the database connection and create your admin account.

Step 5 — Set Correct Permissions

sudo chown -R www-data:www-data /var/www/craft
sudo chmod -R 755 /var/www/craft/storage /var/www/craft/web/cpresources

Step 6 — Configure Nginx

server {
    listen 80;
    server_name yourdomain.com;
    root /var/www/craft/web;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
    }
}
sudo ln -s /etc/nginx/sites-available/craft /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx

Step 7 — Add HTTPS

sudo certbot --nginx -d yourdomain.com

Step 8 — Access the Control Panel

https://yourdomain.com/admin

Understanding Craft's Content Modeling Approach

Unlike WordPress's post/page structure, Craft lets you define completely custom content structures ("sections" and "entry types" with custom fields) — more setup work upfront, but significantly more flexibility for non-standard content types.

Installing Plugins

composer require craftcms/commerce

Then install via the Control Panel's Plugin Store, or activate directly if already required via Composer.

Setting Up Queue Jobs (Background Tasks)

php craft queue/listen

For production, run this as a persistent process via systemd rather than a manual foreground command — see How to Manage Services with systemd and systemctl.

Common Errors

"Craft CMS does not support your current environment" — verify your PHP version and required extensions meet Craft's current minimum requirements, checked against official documentation.

Control panel shows a blank/broken page — verify storage/ and web/cpresources/ permissions are correctly set for the web server user.

Continue Reading

Browse more articles in CMS Platforms Beyond WordPress.

  • craft cms installation, craft cms vps, craft cms setup, craft cms composer
  • 0 utilizatori au considerat informația utilă
Răspunsul a fost util?

Articole similare

How to Install Drupal on a VPS

Drupal is a powerful, highly flexible open-source CMS well-suited for complex content structures,...

How to Install Joomla on a VPS

Joomla is a mature, feature-rich open-source CMS offering a middle ground between WordPress's...

How to Install TYPO3 on a VPS

TYPO3 is an enterprise-grade CMS widely used in Europe for large, complex websites needing...

How to Install Grav (Flat-File CMS) on a VPS

Grav is a modern, flat-file CMS — it stores content as files rather than in a database,...

How to Install Concrete CMS on a VPS

Concrete CMS (formerly concrete5) is known for its intuitive in-context editing experience...