How to Run Multiple WordPress Sites on One VPS with Docker
Running multiple WordPress sites on one VPS with Docker gives each site its own container, its own database, and its own file set, while one server pays the hosting bill. When one site has a plugin problem, the others keep running, because they do not share a PHP process or a database. This guide shows a clean layout for that setup: one Docker network for routing, one folder per site, one database container per site, and Nginx Proxy Manager in front to route each domain to the right container.
You need a VPS with Docker and Docker Compose already installed, a domain name for each site with DNS pointed at the server, and basic comfort with the command line. If Docker is not installed yet, follow the guide to install Docker Compose on Ubuntu 24.04 first. The examples below use two sites, site-a.example.com and site-b.example.com. Replace those domains with your own, and repeat the per-site steps for each additional site.
Plan Multiple WordPress Sites on One VPS
Start with the layout, because a messy folder structure is what makes multi-site servers painful six months later. Keep one folder per site under a common parent, for example /opt/wordpress/site-a and /opt/wordpress/site-b. Inside each site folder, keep a docker-compose.yml file, an uploads folder, and nothing else that another site needs. Shared files between sites cause permission fights and make backups harder to restore one site at a time.
Give each site its own database container and its own database name, user, and password. Sharing one database container between sites saves a small amount of memory, but it also means one bad query or one wrong drop command can hurt every site at once. Separate containers also let you upgrade, restart, or restore one site without touching the others. Check sizing before you add sites, because each WordPress plus database pair needs memory of its own.
Use one shared Docker network for the proxy and all WordPress containers. Nginx Proxy Manager joins that network, and each WordPress container joins it too. The proxy then routes traffic by domain name, so site-a.example.com reaches the site-a container and site-b.example.com reaches the site-b container, even though both run on the same server and the same ports internally. Database containers stay off that shared network, so only WordPress can reach its own database.
Set Up the Shared Proxy First
Install Nginx Proxy Manager once, not once per site. Create a folder such as /opt/npm, put a docker-compose.yml file in it that runs Nginx Proxy Manager with ports 80 and 443 published, and start it with docker compose up -d. Then open its admin panel and add a proxy host for each domain: the domain name, the scheme http, the forward hostname set to the WordPress container name, and the forward port 80. This nginx proxy manager wordpress routing sends each domain to the right container. A full Nginx Proxy Manager setup walkthrough covers the panel steps in detail if this is your first time with it.
Request a certificate for each domain from inside the proxy host settings. Nginx Proxy Manager handles the Let’s Encrypt request for you, and it renews certificates on its own. That keeps every site on HTTPS without a separate certificate step per site. If you want the background on how free certificates work for container apps, read the guide to free SSL certificates with Let’s Encrypt for Docker apps.
One pitfall at this stage is DNS. The proxy cannot issue a certificate for a domain that does not resolve to your server yet. Point each domain DNS A record at the server IP first, wait for it to propagate, then add the proxy host. If a certificate request fails, check DNS with a lookup tool before you retry, because repeated failed requests in a short window can hit rate limits and lock you out for a while.
Create the First Site with Docker Compose
Inside /opt/wordpress/site-a, create a docker-compose.yml file with two services: a database and WordPress. A wordpress docker compose file per site keeps the setup repeatable, and the docker wordpress containers for one site should never mount another site’s volumes. The database service uses the mysql image or mariadb, with a named volume for its data, a root password, and a database name, user, and password for WordPress. The WordPress service uses the wordpress image, depends on the database, passes the same database credentials through environment variables, and mounts a named volume for the WordPress files. Both services join the shared proxy network, while the database also needs no published ports, because nothing outside its WordPress container should reach it.
Start the site with docker compose up -d from inside the site folder. Docker pulls the images on the first run, which can take a few minutes. When the containers report as running, open site-a.example.com in a browser. You should see the WordPress install screen. Fill in the site title, admin user, password, and email, and WordPress creates its tables in the site-a database. The admin password you pick here is separate from the database password in the compose file, and both should be long and unique.
Repeat the same steps for site-b in /opt/wordpress/site-b, with its own folder, its own compose file, its own database name and passwords, and its own proxy host in Nginx Proxy Manager. Nothing in the site-b compose file should point at site-a volumes, databases, or container names. Container names must be unique across the server, so name them plainly, for example site-a-wordpress and site-b-wordpress, and do the same for the database containers.
Compare the Layout Options
| Layout | Best for | Drawback |
| One container set per site, separate databases | Two to twenty independent sites | More memory per site than shared setups |
| WordPress multisite in one container | Sites that share users and plugins | One failure or bad plugin affects every site |
| One shared database container, separate WordPress containers | Tight memory budgets with trusted sites | One database outage takes down every site |
WordPress multisite looks tempting because it runs many sites from one install, but it fits a different problem. It suits a network where sites share users, themes, and plugins by design, such as a chain of branch sites for one business. For unrelated client sites or separate projects, separate containers keep the blast radius small, and a restore or migration touches one site only. If you later need to move one site to its own server, you copy its folder and its volumes, and the other sites never notice.
Handle Updates, Backups, and Common Pitfalls
Update one site at a time. From inside a site folder, run docker compose pull, then docker compose up -d, then open that site and check the admin area and the homepage. If something breaks, you know which site changed and you can roll that one container back while the others keep serving. Updating every site in one sweep makes it hard to tell which change broke what, and a bad plugin update on one site should never force downtime on the rest.
Back up volumes, not just the WordPress files. A WordPress site is two halves: the files in the WordPress volume and the content in the database volume. Backing up only the files leaves you with a theme and uploads but no posts, and backing up only the database leaves you with posts but no media. Set up a routine to back up Docker volumes automatically for every site, and test a restore on a spare folder at least once, because a backup you have never restored is a guess, not a safety net.
Watch disk space and memory as you add sites. Each site adds a database volume, an uploads volume, and log output. Old Docker images pile up after updates, so run docker image prune from time to time to clear images no container uses. If you already have a site on shared hosting, read how to migrate an existing WordPress site from shared hosting to a VPS, then place it into this layout as one more site folder instead of rebuilding it from scratch.
With the proxy routing, one folder per site, and separate databases in place, adding the next site is a repeat of the same steps: new folder, new compose file, new proxy host, new certificate. That repeatability is the point. Keep the folders tidy, keep the passwords unique, and keep the update and backup habits per site, and the server stays manageable as the site count grows.