How to Deploy ProcessWire on a VPS with Automated Git Deployments

Devops & Infrastructure, PHP, Tutorials, and VPS

How to Deploy ProcessWire on a VPS with Automated Git Deployments

ProcessWire's minimal footprint and file-based templates make it well suited for VPS hosting. Unlike shared hosting, a VPS gives you full control over PHP versions, caching layers, and deployment pipelines — exactly what ProcessWire's architecture is designed to take advantage of.

This guide walks through a complete ProcessWire installation on a VPS running Ubuntu 24.04, from server provisioning to automated Git-based deployments with DeployHQ.

Choose a VPS Provider

Any provider that offers Ubuntu 24.04 with root SSH access will work. Recommended options:

Provider Starting Price Best For
Vultr $6/mo (1 vCPU, 1 GB RAM) Global locations, hourly billing, fast provisioning
Hetzner €4.51/mo (2 vCPU, 2 GB RAM) Best price-to-performance ratio in EU/US
DigitalOcean $6/mo (1 vCPU, 1 GB RAM) Beginner-friendly UI, strong documentation
AWS Lightsail $5/mo (1 vCPU, 1 GB RAM) AWS ecosystem integration

For this tutorial we'll use Vultr, but every step applies identically to other providers.

Provision a server with Ubuntu 24.04 LTS, at least 1 GB RAM, and SSH key authentication enabled. Note the server's IP address once it's ready.

Step 1: Initial Server Setup

SSH into your server and update packages:

ssh root@YOUR_SERVER_IP
apt update && apt upgrade -y

Create a non-root user for deployments:

adduser deployer
usermod -aG sudo deployer

Copy your SSH key to the new user:

rsync --archive --chown=deployer:deployer ~/.ssh /home/deployer

From here on, work as the deployer user:

su - deployer

Step 2: Install Nginx, PHP 8.3 and MySQL

Install the LEMP stack components:

sudo apt install -y nginx mysql-server software-properties-common
sudo add-apt-repository -y ppa:ondrej/php
sudo apt update
sudo apt install -y php8.3-fpm php8.3-mysql php8.3-gd php8.3-mbstring \
  php8.3-xml php8.3-curl php8.3-zip php8.3-intl php8.3-opcache

Verify PHP is running:

php -v
# PHP 8.3.x (cli)
sudo systemctl status php8.3-fpm

Step 3: Configure MySQL

Secure the MySQL installation and create a database for ProcessWire:

sudo mysql_secure_installation

Then create the database and user:

sudo mysql -u root -p
CREATE DATABASE processwire CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'pw_user'@'localhost' IDENTIFIED BY 'YOUR_STRONG_PASSWORD_HERE';
GRANT ALL PRIVILEGES ON processwire.* TO 'pw_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Replace YOUR_STRONG_PASSWORD_HERE with a strong, unique password. Store it somewhere safe — you'll need it during ProcessWire's web installer.

Step 4: Configure Nginx

Create an Nginx server block for your ProcessWire site:

sudo nano /etc/nginx/sites-available/processwire
server {
    listen 80;
    server_name your-domain.com www.your-domain.com;
    root /var/www/processwire;
    index index.php index.html;

    # ProcessWire rewrites
    location / {
        try_files $uri $uri/ /index.php?it=$uri&$args;
    }

    # PHP processing
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.3-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    # Protect sensitive directories
    location ~ /site/assets/(cache|logs|backups|sessions|config|install) {
        deny all;
    }

    location ~ /site/(install|config\.php) {
        deny all;
    }

    location ~ /\.ht {
        deny all;
    }
}

Enable the site and test the configuration:

sudo ln -s /etc/nginx/sites-available/processwire /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

Step 5: Install ProcessWire

Install Composer if not already present, then create the ProcessWire project:

sudo apt install -y composer
cd /var/www
sudo composer create-project processwire/processwire processwire
sudo chown -R deployer:www-data /var/www/processwire
sudo chmod -R 755 /var/www/processwire
sudo chmod -R 775 /var/www/processwire/site/assets

Open http://your-domain.com in a browser to run ProcessWire's web installer. Enter the MySQL credentials you created in Step 3 and follow the setup wizard.

After installation, remove the install directory:

rm -rf /var/www/processwire/site/install

Step 6: SSL with Let's Encrypt

Install Certbot and generate a free SSL certificate:

sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.com -d www.your-domain.com

Certbot automatically modifies your Nginx config to redirect HTTP to HTTPS and sets up auto-renewal.

Step 7: Set Up Git-Based Deployments with DeployHQ

Manual file uploads are error-prone. Set up automated deployments so every git push updates your live site.

Prepare the Git Repository

On your local machine, initialise a Git repo for your ProcessWire project:

cd my-processwire-project
git init

Create a .gitignore to keep environment-specific files out of version control:

/site/assets/cache/*
/site/assets/logs/*
/site/assets/sessions/*
/site/config.php
/vendor/
.env

Commit and push to your Git provider (GitHub, GitLab, or Bitbucket):

git add .
git commit -m "Initial ProcessWire setup"
git remote add origin <your-repo-url>
git push -u origin main

Connect DeployHQ

  1. Sign up for DeployHQ (free tier available — 1 project, 5 deploys/day)
  2. Create a new project and connect your Git repository
  3. Add your VPS as a server:

    • Protocol: SSH/SFTP
    • Hostname: your server IP or domain
    • Port: 22
    • Username: deployer
    • Authentication: SSH key (DeployHQ generates one — add its public key to ~/.ssh/authorized_keys on your server)
    • Deployment path: /var/www/processwire
  4. Add build commands under Build Pipeline:

    composer install --no-dev --optimize-autoloader
    
  5. Add SSH commands to run after deployment:

    sudo chown -R deployer:www-data /var/www/processwire
    rm -rf /var/www/processwire/site/assets/cache/*
    
  6. Enable automatic deployments for your main branch

Deploy

Push a change and DeployHQ handles the rest:

git push origin main

DeployHQ detects the push, runs your build commands, deploys only the changed files via SSH, and clears the cache. If anything goes wrong, one-click rollback reverts to the previous deployment.

For zero-downtime deployments on production sites, see our guide to zero-downtime deployments with DeployHQ.

Security Hardening

A few additional steps to lock down your VPS:

Firewall — allow only SSH, HTTP, and HTTPS:

sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw enable

Disable root SSH login — edit /etc/ssh/sshd_config:

PermitRootLogin no
PasswordAuthentication no

Then restart SSH:

sudo systemctl restart sshd

Automatic security updates:

sudo apt install -y unattended-upgrades
sudo dpkg-reconfigure -plow unattended-upgrades

Optional: OPcache and Performance Tuning

ProcessWire benefits from PHP OPcache tuning. Edit /etc/php/8.3/fpm/conf.d/10-opcache.ini:

opcache.enable=1
opcache.memory_consumption=128
opcache.max_accelerated_files=10000
opcache.revalidate_freq=60

Restart PHP-FPM:

sudo systemctl restart php8.3-fpm

For sites with heavy read traffic, consider adding Redis or a CDN like Cloudflare in front of Nginx.


For a broader comparison of ProcessWire vs WordPress — including when to choose each — see Deploy ProcessWire as Your WordPress Alternative. And if you're evaluating other PHP CMS options, check out our Craft CMS vs WordPress comparison.

Ready to automate your ProcessWire deployments? Start deploying with DeployHQ for free — no credit card required.

Have questions? Reach out at support@deployhq.com or find us on X (@deployhq).