Skip to content

Installing ProcessWire CMS on Ubuntu

Operator-grade install of ProcessWire 3.x on Ubuntu 22.04 with Nginx, PHP-FPM, and MariaDB — including the site profile choice, $config tweaks, and the hardening the installer does not enforce.

ProcessWire is a PHP CMS with a content model built around pages-as-trees and template files that resolve to those pages. It runs on the LEMP stack but does not ship a Composer-first install — you download a zip, configure site/config.php, and run a one-page installer that creates the database tables. This article walks through a clean ProcessWire 3.x install on Ubuntu 22.04 with the operator-grade defaults the installer doesn’t apply by default.

How to verify

After install, the site should answer like this:

curl -sI https://example.org/ | head -1
# HTTP/2 200

curl -s https://example.org/processwire/login/ | grep -oP 'name="processwire-version" content="\K[^"]+'
# 3.0.229

ls -la /var/www/processwire/site/install/
# (directory should NOT exist on a finished install)

sudo -u www-data find /var/www/processwire -maxdepth 2 -type d -perm -o+w
# (should be empty)

mysql -h127.0.0.1 -uroot -p -e "SHOW TABLES FROM processwire LIKE 'pages';"
# pages

If the site/install/ directory still exists, anyone who finds the URL can re-run the installer over your database — delete it before going to production.

What’s happening

ProcessWire’s content model is a tree of pages; everything is a page including users, roles, settings, and templates. The database has a few core tables (pages, templates, fields, fieldgroups, pages_access, pages_parents, plus one field_<fieldname> table per defined field) — that is the entire schema regardless of how many pages or page types you build. Page templates are PHP files in site/templates/ that get included when a request resolves to a page using that template; the API surface is the $page, $pages, and $user superglobals.

The installer is a one-page wizard that runs under site/install/. It asks for the database connection, the site profile (Default, Blank, Regular, Intermediate, Beginner), the admin URL prefix, and the admin password. After it finishes, it asks you to delete the site/install/ directory — that’s the only post-install safety prompt. The site profiles are not migrations — once installed, switching profiles is a manual exercise.

ProcessWire ships with $config->debug = true off by default, but $config->httpHosts is empty until you set it. Empty means the CMS accepts requests with any Host header, which is fine for dev but a footgun in production (Host header spoofing attacks). Set it explicitly.

The procedure

  1. Install the LEMP base.

    sudo apt update
    sudo apt install -y nginx mariadb-server \
      php8.2-fpm php8.2-mysql php8.2-gd php8.2-curl php8.2-mbstring \
      php8.2-xml php8.2-zip php8.2-intl php8.2-bcmath php8.2-opcache \
      unzip wget
  2. Provision the database.

    DBPASS=$(openssl rand -hex 24)
    sudo mariadb <<SQL
    CREATE DATABASE processwire CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    CREATE USER 'processwire'@'127.0.0.1' IDENTIFIED BY '${DBPASS}';
    GRANT ALL ON processwire.* TO 'processwire'@'127.0.0.1';
    FLUSH PRIVILEGES;
    SQL
  3. Download and unpack ProcessWire.

    sudo useradd -m -s /bin/bash deployer
    sudo usermod -aG www-data deployer
    sudo mkdir -p /var/www/processwire && sudo chown deployer:www-data /var/www/processwire
    sudo -u deployer -- bash -lc '
      cd /var/www/processwire
      wget -q https://github.com/processwire/processwire/archive/refs/heads/master.tar.gz
      tar -xzf master.tar.gz --strip-components=1
      rm master.tar.gz
    '
    sudo chown -R deployer:www-data /var/www/processwire
    sudo find /var/www/processwire -type d -exec chmod 755 {} \;
    sudo find /var/www/processwire -type f -exec chmod 644 {} \;
    sudo chmod -R 775 /var/www/processwire/site/assets
  4. Configure Nginx. ProcessWire ships an example config under htaccess.txt (Apache) and one for Nginx in the docs. The key rewrite:

    server {
      listen 443 ssl http2;
      server_name example.org;
      root /var/www/processwire;
      index index.php;
      ssl_certificate /etc/letsencrypt/live/example.org/fullchain.pem;
      ssl_certificate_key /etc/letsencrypt/live/example.org/privkey.pem;
      client_max_body_size 50m;
    
      location / {
        try_files $uri $uri/ /index.php?it=$uri&$query_string;
      }
      location ~ \.php$ {
        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
      }
      # block direct access to ProcessWire's protected directories
      location ~* /(site|wire)/(config|install|modules|core)/ { deny all; }
      location ~ /\.(?!well-known) { deny all; }
    }
  5. Run the web installer. Visit https://example.org/site/install/. Pick the “Site - Regular” profile, enter the DB credentials, set the admin URL to something not /processwire/ (e.g. /admin-7a8b/), generate a long admin password.

  6. Delete the installer.

    sudo -u deployer rm -rf /var/www/processwire/site/install
  7. Harden site/config.php. Append:

    $config->httpHosts = ['example.org', 'www.example.org'];
    $config->debug = false;
    $config->sessionFingerprint = true;
    $config->sessionChallenge = true;
    $config->protectCSRF = true;
    $config->chmodDir = '0755';
    $config->chmodFile = '0644';
    $config->prependTemplateFile = '_init.php';
    $config->appendTemplateFile = '_main.php';

    Then make it read-only:

    sudo chmod 440 /var/www/processwire/site/config.php
  8. Install ProMods or other essential modules through the admin (/admin-7a8b/module/). The TracyDebugger module is the right call for staging only — never enable it in production unless you’ve also restricted who can reach /?debug=true.

Common pitfalls

  • The default admin URL is /processwire/ — change it during install or expect bot traffic to hammer the login.
  • ProcessWire stores file uploads in site/assets/files/<page_id>/ — that directory grows with the site and must be on a backed-up volume.
  • The “Sessions Database” config option moves session storage from disk to the DB; useful for load-balanced deploys, but the table grows unboundedly without a cleanup cron.
  • site/templates/ files are included on every render — heavy wireIncludeFile in there shows up as TTFB on every page.
  • wire/ (the framework) and site/ (your site) update independently. The recommended upgrade path is to drop in a new wire/ from the release, run any migrations from /admin/upgrade/, then commit. Mixing files across versions in the same release is the most common upgrade error.

For sites that run on ProcessWire, Stack Harbor operates the boring half — PHP and MariaDB updates pinned to the support window, file permissions enforced by a cron, debug never reachable in production, backups verified by restore — so the content team only sees the admin. That model lives under managed operations, with related notes in the knowledge base.