Running multiple websites doesn't mean paying for multiple hosting accounts. A single VPS with 2-4GB of RAM can comfortably host 5-20 WordPress sites, depending on traffic. If you're a freelancer managing client sites, running multiple business projects, or building a portfolio of niche blogs, consolidating onto one server saves real money.
Here's how to set it up properly.
What You'll Need
- A VPS with at least 2GB RAM (4GB recommended for 5+ sites)
- Ubuntu 22.04 or 24.04 LTS
- SSH access with a non-root sudo user
- Domain names pointed to your server's IP address
Step 1: Install the LEMP Stack
If you're starting fresh, install Nginx, MySQL, and PHP:
sudo apt update && sudo apt upgrade -y # Install Nginx sudo apt install nginx -y # Install MySQL sudo apt install mysql-server -y sudo mysql_secure_installation # Install PHP 8.2 and required extensions sudo apt install php8.2-fpm php8.2-mysql php8.2-xml php8.2-mbstring \\ php8.2-curl php8.2-zip php8.2-gd php8.2-intl php8.2-imagick -y Verify everything is running:
sudo systemctl status nginx sudo systemctl status mysql sudo systemctl status php8.2-fpm Step 2: Create a Database for Each Site
Every WordPress site needs its own database and user:
sudo mysql -u root -p -- Site 1 CREATE DATABASE site1_db; CREATE USER 'site1_user'@'localhost' IDENTIFIED BY 'strong_password_1'; GRANT ALL PRIVILEGES ON site1_db.* TO 'site1_user'@'localhost'; -- Site 2 CREATE DATABASE site2_db; CREATE USER 'site2_user'@'localhost' IDENTIFIED BY 'strong_password_2'; GRANT ALL PRIVILEGES ON site2_db.* TO 'site2_user'@'localhost'; FLUSH PRIVILEGES; EXIT; Security tip: Use unique passwords for each database user. Never reuse credentials across sites — if one site gets compromised, the others stay safe.
Step 3: Set Up Directory Structure
Create a clean, organized directory structure:
# Create directories for each site sudo mkdir -p /var/www/site1.com/public_html sudo mkdir -p /var/www/site2.com/public_html # Set ownership sudo chown -R www-data:www-data /var/www/site1.com sudo chown -R www-data:www-data /var/www/site2.com Step 4: Install WordPress for Each Site
# Site 1 cd /var/www/site1.com/public_html sudo wget https://wordpress.org/latest.tar.gz sudo tar -xzf latest.tar.gz --strip-components=1 sudo rm latest.tar.gz # Site 2 cd /var/www/site2.com/public_html sudo wget https://wordpress.org/latest.tar.gz sudo tar -xzf latest.tar.gz --strip-components=1 sudo rm latest.tar.gz # Fix permissions sudo chown -R www-data:www-data /var/www/site1.com sudo chown -R www-data:www-data /var/www/site2.com Configure wp-config.php for each site:
cd /var/www/site1.com/public_html sudo cp wp-config-sample.php wp-config.php sudo nano wp-config.php Update the database settings:
define('DB_NAME', 'site1_db'); define('DB_USER', 'site1_user'); define('DB_PASSWORD', 'strong_password_1'); define('DB_HOST', 'localhost'); Don't forget to generate unique security keys at api.wordpress.org/secret-key and paste them in.
Step 5: Configure Nginx Virtual Hosts
This is the key to running multiple sites. Each site gets its own Nginx server block:
sudo nano /etc/nginx/sites-available/site1.com server { listen 80; server_name site1.com www.site1.com; root /var/www/site1.com/public_html; index index.php index.html; # Security headers add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Content-Type-Options "nosniff" always; # Max upload size client_max_body_size 64M; location / { try_files $uri $uri/ /index.php?$args; } location ~ \\.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } # Deny access to sensitive files location ~ /\\.ht { deny all; } location = /wp-config.php { deny all; } } Create a similar file for site2.com, then enable both:
sudo ln -s /etc/nginx/sites-available/site1.com /etc/nginx/sites-enabled/ sudo ln -s /etc/nginx/sites-available/site2.com /etc/nginx/sites-enabled/ # Test configuration sudo nginx -t # Reload sudo systemctl reload nginx Step 6: Install SSL Certificates
Use Certbot to get free SSL for all your sites in one command:
sudo apt install certbot python3-certbot-nginx -y # Install certificates for all sites sudo certbot --nginx -d site1.com -d www.site1.com sudo certbot --nginx -d site2.com -d www.site2.com Certbot automatically modifies your Nginx configs to handle HTTPS and sets up auto-renewal.
Step 7: Optimize PHP for Multiple Sites
The default PHP-FPM settings are conservative. Tune them for multiple sites:
sudo nano /etc/php/8.2/fpm/pool.d/www.conf For a 2GB VPS with 5 sites:
pm = dynamic pm.max_children = 20 pm.start_servers = 5 pm.min_spare_servers = 3 pm.max_spare_servers = 10 pm.max_requests = 500 For a 4GB VPS with 10+ sites:
pm = dynamic pm.max_children = 40 pm.start_servers = 10 pm.min_spare_servers = 5 pm.max_spare_servers = 20 pm.max_requests = 500 Also increase PHP memory limit:
sudo nano /etc/php/8.2/fpm/php.ini memory_limit = 256M upload_max_filesize = 64M post_max_size = 64M max_execution_time = 300 Restart PHP-FPM:
sudo systemctl restart php8.2-fpm Managing Multiple Sites Efficiently
Use WP-CLI
WP-CLI is essential for managing multiple WordPress installations from the command line:
# Install WP-CLI curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar chmod +x wp-cli.phar sudo mv wp-cli.phar /usr/local/bin/wp Now you can manage any site without opening a browser:
# Update WordPress core sudo -u www-data wp core update --path=/var/www/site1.com/public_html # Update all plugins sudo -u www-data wp plugin update --all --path=/var/www/site1.com/public_html # Check site health sudo -u www-data wp doctor check --all --path=/var/www/site1.com/public_html Create an Update Script
Automate updates across all sites:
#!/bin/bash # update-all-sites.sh SITES=( "/var/www/site1.com/public_html" "/var/www/site2.com/public_html" "/var/www/site3.com/public_html" ) for site in "${SITES[@]}"; do echo "Updating: $site" sudo -u www-data wp core update --path="$site" 2>/dev/null sudo -u www-data wp plugin update --all --path="$site" 2>/dev/null sudo -u www-data wp theme update --all --path="$site" 2>/dev/null echo "---" done echo "All sites updated!" Centralized Backups
Back up all sites with a single cron job:
#!/bin/bash # backup-all.sh DATE=$(date +%Y-%m-%d) BACKUP_DIR="/home/deploy/backups/$DATE" mkdir -p "$BACKUP_DIR" # Site 1 mysqldump -u site1_user -p'password' site1_db | gzip > "$BACKUP_DIR/site1_db.sql.gz" tar -czf "$BACKUP_DIR/site1_files.tar.gz" -C /var/www/site1.com/public_html . # Site 2 mysqldump -u site2_user -p'password' site2_db | gzip > "$BACKUP_DIR/site2_db.sql.gz" tar -czf "$BACKUP_DIR/site2_files.tar.gz" -C /var/www/site2.com/public_html . # Clean up backups older than 14 days find /home/deploy/backups -type d -mtime +14 -exec rm -rf {} + Add to cron:
crontab -e 0 3 * * * /home/deploy/backup-all.sh Performance Tips for Multi-Site VPS
Install Redis for object caching across all sites:
sudo apt install redis-server php8.2-redis -y sudo systemctl enable redis-server Install the Redis Object Cache plugin on each WordPress site.
Enable Nginx FastCGI caching for static pages — this dramatically reduces PHP processing:
# Add to your http block in nginx.conf fastcgi_cache_path /tmp/nginx-cache levels=1:2 keys_zone=WORDPRESS:100m inactive=60m; # Add to each server block set $skip_cache 0; if ($request_method = POST) { set $skip_cache 1; } if ($query_string != "") { set $skip_cache 1; } if ($request_uri ~* "/wp-admin/|/wp-json/") { set $skip_cache 1; } location ~ \\.php$ { fastcgi_cache WORDPRESS; fastcgi_cache_valid 200 60m; fastcgi_cache_bypass $skip_cache; fastcgi_no_cache $skip_cache; # ... rest of PHP config } Monitor resource usage to know when to upgrade:
# Quick check htop # Disk usage per site du -sh /var/www/*/ How Many Sites Can One VPS Handle?
| VPS Size | Sites (Low Traffic) | Sites (Medium Traffic) |
|---|---|---|
| 1GB RAM | 2-3 | 1-2 |
| 2GB RAM | 5-10 | 3-5 |
| 4GB RAM | 10-20 | 5-10 |
| 8GB RAM | 20-50 | 10-20 |
"Low traffic" = under 1,000 daily visitors per site. "Medium traffic" = 1,000-10,000 daily visitors.
Start Hosting Smarter
Running multiple WordPress sites on a single VPS is one of the best ways to reduce hosting costs while maintaining full control. A $20-30/month VPS can replace five separate $10/month shared hosting accounts — with better performance.
At DeployBase, our hosting plans are built for exactly this use case: several sites side by side on one plan. Starting at $5.99/month with NVMe SSD storage and email support, you can host as many sites as your plan resources can handle. One plan, one bill, zero compromises.
Host all your sites on one DeployBase plan → — consolidate your hosting, cut your costs.