Skip to content

Deploying a WordPress Multisite App

Introduction

WordPress Multisite lets you run many sites from a single WordPress instance. This guide shows how to containerize Multisite with a Dockerfile, connect it to MySQL, persist uploads, and deploy it to Klutch.sh over HTTP.

Prerequisites

  • GitHub repository containing your Dockerfile.
  • MySQL database (managed or deployed separately).
  • Klutch.sh project ready in klutch.sh/app.
  • Plan for domain or subdomain mapping for your network.

Project structure

.
└── Dockerfile

Sample Dockerfile

FROM wordpress:6.5-php8.2-apache
# Default WordPress port
ENV APACHE_PORT=80
EXPOSE 80

Required environment variables

  • WORDPRESS_DB_HOST – MySQL host and port
  • WORDPRESS_DB_USER
  • WORDPRESS_DB_PASSWORD
  • WORDPRESS_DB_NAME
  • APACHE_PORT=80

Multisite configuration (add to env or bake into config)

  • WORDPRESS_CONFIG_EXTRA to enable Multisite, e.g.:

    define('WP_ALLOW_MULTISITE', true);
    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', false); // set true if you use subdomains
    define('DOMAIN_CURRENT_SITE', 'example-app.klutch.sh');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);

Optional environment variables

  • WORDPRESS_TABLE_PREFIX=wp_
  • WORDPRESS_DEBUG=false
  • WP_MEMORY_LIMIT=256M

Persistence

Persist plugins, themes, and uploads for all sites:

  • Mount path: /var/www/html/wp-content
  • Size: based on expected media, plugins, and themes across the network

Networking

  • Protocol: HTTP
  • Internal port: 80
  • Users reach https://example-app.klutch.sh while Klutch.sh routes to port 80 inside the container.
Terminal window
curl -I http://localhost

Deployment on Klutch.sh

  1. Push your Dockerfile to GitHub.
  2. In klutch.sh/app, create a new app and select GitHub as the source.
  3. Klutch.sh automatically detects the Dockerfile in the repository root.
  4. Select HTTP traffic and set the internal port to 80.
  5. Add environment variables for WORDPRESS_DB_HOST, WORDPRESS_DB_USER, WORDPRESS_DB_PASSWORD, WORDPRESS_DB_NAME, and WORDPRESS_CONFIG_EXTRA for Multisite. Mark secrets as sensitive.
  6. Attach a persistent volume at /var/www/html/wp-content sized for uploads and custom code across sites.
  7. Deploy. Run the WordPress setup wizard, enable Multisite in the dashboard, and create network sites as needed.

Verification

  • UI: open https://example-app.klutch.sh and confirm the site loads.
  • Network admin: after enabling Multisite, access https://example-app.klutch.sh/wp-admin/network/ to verify network setup.

Next steps

  • Configure HTTPS at the edge and set site/network URLs accordingly.
  • Enable backups for MySQL and the /var/www/html/wp-content volume.
  • Plan DNS entries for subdomain installs or configure domain mapping plugins for custom domains.