DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
VGSources
Blog

How to Dockerize and Deploy Multiple WordPress Sites on a VPS

Run multiple WordPress sites safely on one VPS with one Compose project per site, persistent volumes, private databases and host-based HTTPS routing through a shared reverse proxy.
Length11 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The dependable pattern is one Docker Compose project per WordPress site, with a dedicated WordPress container, a dedicated MariaDB or MySQL container, and named volumes for both application files and database data. Put every WordPress service on a shared reverse-proxy network, keep each database on its private project network, and route domains by hostname. This gives every site independent updates, backups, rollbacks and failure boundaries while one VPS supplies the compute.

What the architecture looks like

Each site is an independent Compose project. A project normally contains two services:

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • WordPress: the PHP application and web server, with persistent data mounted at /var/www/html.
  • MariaDB or MySQL: the database, with its data directory mounted at /var/lib/mysql.

A reverse proxy such as Traefik, NGINX or Caddy listens on ports 80 and 443. It examines the requested hostname and forwards site-a.example to site A’s WordPress service and site-b.example to site B’s service. The proxy and WordPress containers share an external network; databases do not join that network.

Docker service names provide stable internal DNS. WordPress should use a database host such as db:3306, where db is the Compose service name. Container IP addresses are assigned dynamically and can change whenever a container is recreated, so an IP address must never be placed in wp-config.php.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Separate Compose projects or WordPress Multisite?

Decision factor Independent Compose projects WordPress Multisite
Isolation Each site has its own application container, database, volumes and private network. Sites share one WordPress installation and database environment.
Updates Update or roll back one site without changing the others. Core and many operational changes affect the network together.
Backup and restore Restore one site’s SQL dump and files without handling unrelated sites. Granularity depends on the Multisite database and file layout.
Domain mapping Host-based proxy rules select a Compose service directly. Domain mapping is managed inside one WordPress network and still needs correct proxy and DNS configuration.
Operational overhead More Compose files, volumes and update jobs to maintain. Fewer containers, but shared failures and permissions have a wider blast radius.

Use separate projects when the sites belong to different owners, require different plugins or PHP extensions, or need independent maintenance windows. Multisite is appropriate when one team intentionally operates a group of closely related sites as one WordPress installation. The official WordPress sample notes that Multisite works only on ports 80 and 443; it is not a substitute for arbitrary per-site port mappings.

Plan the VPS before installing anything

Choose names and directories

Give every site a short, unique project name and directory, for example /srv/wordpress/site-a and /srv/wordpress/site-b. The project name becomes part of automatically generated volume names, so uniqueness prevents accidental collisions. Keep a separate directory for proxy configuration and its certificate storage.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install the prerequisites

  • A VPS with a public IPv4 address and an operating-system account allowed to run Docker.
  • Docker Engine and the Docker Compose plugin installed from the operating system’s supported packages.
  • Firewall rules permitting TCP ports 80 and 443 to the proxy. Do not expose database ports publicly.
  • DNS control for every domain or subdomain you will publish.

There is no authoritative universal CPU, RAM or storage number for a portfolio of WordPress sites. Traffic, PHP workers, plugins, media volume, scheduled jobs and database size determine the requirement. Start with measured resource usage, leave headroom for backups and updates, and monitor memory, CPU, disk space and container restarts.

Create the networks once

The proxy network is shared by projects and therefore must exist before Compose starts a site that declares it external:

docker network create traefik-network

Each project creates its own private application network automatically. If you prefer to create one explicitly, do so inside the project directory:

docker network create site-a-wordpress-network

Never attach a database to traefik-network. A proxy only needs to reach the WordPress HTTP service; the database should be reachable solely from the WordPress service on the private network.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Build a Compose file for each site

Save the following as /srv/wordpress/site-a/compose.yaml. The image tags shown are examples; pin each image to a version you have tested rather than using an unqualified latest tag in production.

services:
  db:
    image: mariadb:10.11
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: wordpress
      MYSQL_USER: wp_user
      MYSQL_PASSWORD: use-a-long-random-password
      MYSQL_ROOT_PASSWORD: use-a-different-long-random-password
    volumes:
      - db_data:/var/lib/mysql
    networks:
      - private

  wordpress:
    image: wordpress:php8.2-apache
    restart: unless-stopped
    depends_on:
      - db
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_NAME: wordpress
      WORDPRESS_DB_USER: wp_user
      WORDPRESS_DB_PASSWORD: use-a-long-random-password
    volumes:
      - wp_data:/var/www/html
    networks:
      - private
      - proxy
    labels:
      - traefik.enable=true
      - traefik.http.routers.site-a.rule=Host(`site-a.example`)
      - traefik.http.routers.site-a.entrypoints=websecure
      - traefik.http.routers.site-a.tls=true
      - traefik.http.routers.site-a.tls.certresolver=letsencrypt
      - traefik.http.services.site-a.loadbalancer.server.port=80

volumes:
  wp_data:
  db_data:

networks:
  private:
  proxy:
    external: true
    name: traefik-network

Replace the example domain and secrets with values unique to this site. Keep the same database name, user and password in both services. Compose resolves db through the private network; there is no need to discover or record a container IP.

Why the two volumes matter

The WordPress volume contains core files, plugins, themes, uploads and the generated wp-config.php used by the image. The database volume contains MariaDB’s data files. Compose creates a named volume if it does not already exist and reuses it on later deployments. Recreating a container therefore does not erase the site.

Configure the reverse proxy

Traefik can read the labels in the Compose file, terminate TLS and send requests to the correct service. Its static configuration must define an HTTP entrypoint, an HTTPS entrypoint and the certificate resolver named in the labels. The proxy itself must be attached to traefik-network.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

NGINX and Caddy use different configuration models but the same network design: each virtual host points at the relevant Compose service name and port. Choose the proxy your team can monitor and troubleshoot. Traefik is convenient when routing is declared beside each service; NGINX is familiar where configuration files and explicit control are preferred; Caddy emphasizes concise configuration and automatic certificates. Certificate automation, observability and staff experience matter more than the brand of proxy.

Forward the original protocol

When TLS ends at the proxy, WordPress must know that the browser used HTTPS. Forward X-Forwarded-Proto: https (and the usual host and client headers) from the proxy. The official WordPress image documents this requirement for reverse-proxy HTTPS. Without it, administrators can see redirect loops, mixed-content URLs or repeated login prompts.

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Protect the proxy dashboard

If a dashboard is enabled, require authentication and avoid publishing it on an unprotected hostname. A dashboard can reveal routing, service names and operational details that should not be public.

Point domains to the VPS

  1. Create an A record for each hostname, such as site-a.example, pointing to the VPS public IP.
  2. Wait for the DNS record to resolve from outside your network.
  3. Confirm that the proxy’s host rule exactly matches the requested hostname, including the www variant if you intend to serve it.
  4. Allow the proxy to request certificates only after DNS reaches the VPS and ports 80 and 443 are reachable.

DNS propagation can take a few minutes to 48 hours, and occasionally longer. During that period, certificate requests may fail from resolvers that still hold the old record. Check resolution from multiple networks before treating a proxy configuration as broken.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Start, inspect and test a site

  1. Change into the site’s directory: cd /srv/wordpress/site-a.
  2. Choose a unique project name and start it: docker compose -p site_a up -d.
  3. Check running containers with docker ps.
  4. Follow application output with docker compose logs -f wordpress or database output with docker compose logs -f db.
  5. Open the domain over HTTPS and complete the WordPress installer, or verify that the imported site loads.
  6. Confirm that an uploaded media file remains after docker compose -p site_a up -d recreates a changed container.

Repeat the same process in a separate directory and project name for every additional site. One project’s service names and volumes do not collide with another project’s names when the project names are unique.

Keep data private and persistent

Network boundaries

The WordPress service joins both networks, so it can receive proxy traffic and query MariaDB. The database joins only the private network. Compose’s frontend/backend network pattern prevents the proxy from reaching the database directly and avoids publishing port 3306 on the VPS.

Destructive commands to avoid

docker compose down stops and removes the project’s containers but preserves named volumes. docker compose down --volumes also removes the project’s named volumes, deleting the stored WordPress files and database. Treat the latter as a data-destruction command and use it only when you have deliberately archived the site or are resetting it.

File permissions and capacity

WordPress must be able to write uploads, plugin updates and generated cache files inside /var/www/html. If uploads fail, inspect ownership and permissions inside the container rather than making the entire VPS filesystem writable. Monitor free space in both the VPS filesystem and Docker’s volume storage; a full disk can take down every site on the host.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

Back up both layers

A usable backup consists of a database export and a copy of the WordPress volume. Either one alone is incomplete: SQL contains posts, settings and users, while the files contain uploads, themes, plugins and WordPress code.

Export the database

Run the dump from the project directory and write it outside the container:

docker compose exec -T db sh -c 'mysqldump -u root -p"$MYSQL_ROOT_PASSWORD" "$MYSQL_DATABASE"' > site-a-$(date +%F).sql

Protect the resulting SQL file as you would any credential-bearing backup. You can use phpMyAdmin instead, but it must also produce a complete SQL export rather than only selected tables.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Copy the WordPress files

Archive the named WordPress volume, including uploads and custom code. The exact volume name includes the Compose project prefix; inspect it with docker volume ls before running the archive:

docker run --rm -v site_a_wp_data:/data -v /srv/backups:/backup alpine tar czf /backup/site-a-files-$(date +%F).tar.gz -C /data .

Store backups on separate physical or cloud storage, retain multiple dated copies, and periodically perform a restore into a disposable project. A backup that has never been restored is only an assumption.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Migrate an existing WordPress site

  1. Create the destination Compose project, volumes and private network, but do not point production DNS at it yet.
  2. Export the source database with mysqldump or phpMyAdmin.
  3. Copy the source wp-content and other required WordPress files into the persistent WordPress volume. Preserve uploads, themes, plugins and custom code.
  4. Copy the SQL dump into the MariaDB container or stream it through docker compose exec -T db and import it into the configured database.
  5. Check the destination environment variables and any committed wp-config.php. The database host must be the Compose service name, normally db, and credentials must match the database service.
  6. Open the site through a temporary hostname or hosts-file entry, verify logins, media, permalinks and scheduled jobs, and correct URL or HTTPS settings before cutover.
  7. Lower DNS TTL ahead of the final change when possible, switch the A record, then watch proxy and WordPress logs while the new record propagates.

Keep the source site available until the destination has passed the checks and a fresh backup exists. If content changes during the copy, schedule a brief maintenance window and take a final database export immediately before the DNS change.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

Update safely and roll back

When the Compose file or image tag changes, docker compose up -d recreates the affected container while retaining named volumes. Use a tested, pinned image tag and record the previous tag before updating. Update one site at a time, check its front end and administration area, and inspect logs for PHP, database or proxy errors.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Back up the database and files.
  2. Review the image release and any required PHP extensions or configuration changes.
  3. Change only the intended image tag or setting in that site’s Compose file.
  4. Run docker compose -p site_a up -d.
  5. Verify health, login, media uploads, cron tasks and HTTPS redirects.
  6. If the release fails, restore the prior image tag and run the same command, then restore data only if the update changed the database schema and the backup requires it.

Additional PHP extensions are not obtained by changing a runtime environment variable. Build a custom image with a Dockerfile based on the WordPress image, install the extension there, pin the resulting image, and test it before deployment.

Scaling and resource limits

Compose can start multiple WordPress replicas with docker compose up --scale wordpress=2, but replicas require shared media storage and, where applicable, externalized session state. A local named volume mounted independently into each replica does not provide shared uploads. Most small VPS portfolios are simpler to operate as independent single-instance projects; scale only after measurements show that one container is the bottleneck.

Databases usually remain one service per site. If a site outgrows the VPS, move its database or media to infrastructure designed for that workload rather than casually adding replicas that cannot share state correctly.

Troubleshooting by symptom

The site shows a proxy 404 or the wrong site

  • Confirm the DNS A record reaches this VPS.
  • Check that the requested hostname exactly matches the proxy rule.
  • Ensure the WordPress service is attached to the external proxy network.
  • Inspect proxy labels or virtual-host configuration for a duplicate router name.

WordPress cannot connect to MariaDB

  • Use db:3306, not a container IP or localhost, as the database host.
  • Confirm both services share the private network.
  • Check that database name, user and password are identical in the two service definitions.
  • Read docker compose logs db for initialization or permission failures.

HTTPS redirects loop

  • Verify that the proxy terminates TLS and forwards X-Forwarded-Proto: https.
  • Check WordPress URL settings for an HTTPS URL.
  • Ensure the proxy is not forwarding HTTPS traffic to a service that is simultaneously forcing an incompatible redirect.

Data disappeared after maintenance

  • Check whether docker compose down --volumes was run.
  • List existing volumes with docker volume ls and compare their project prefixes.
  • Restore the SQL dump and file archive into a new project if the original volumes were deleted.

Certificates will not issue

  • Wait for DNS propagation, which can last from minutes to 48 hours or longer.
  • Confirm ports 80 and 443 are reachable from the public internet.
  • Check that the certificate resolver, router entrypoint and hostname are spelled consistently.

Operational checklist

  • One directory and unique Compose project name per site.
  • Separate WordPress and database named volumes for every project.
  • Database reachable only on the private project network.
  • WordPress attached to both private and shared proxy networks.
  • Host-based routing for every domain and HTTPS enabled at the proxy.
  • X-Forwarded-Proto forwarded when TLS terminates before WordPress.
  • Pinned, tested image tags and a documented rollback tag.
  • Regular SQL dumps plus WordPress file archives stored off the VPS.
  • Restore tests, disk monitoring and log review after each update.
  • No use of docker compose down --volumes unless data deletion is intentional.

This design keeps each WordPress site independently deployable while the shared proxy supplies one public HTTPS front door. The boundaries are clear: domains route by hostname, service names locate databases, named volumes preserve state, and backups provide the recovery path when a container, update or VPS fails.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.