Language & currency
Currency

Gratis Website & Server Migratie

Kolonel Server
Multiple Websites - Host Several Sites on One VPS

Invoering

A Virtuele privéserver (VPS) biedt een flexibel en kosteneffectief platform voor het hosten van meerdere websites op één server. Of u nu persoonlijke projecten beheert, websites van klanten, ontwikkelomgevingen, of zakelijke toepassingen, het consolideren van meerdere domeinen op één VPS kan het beheer vereenvoudigen en tegelijkertijd de hostingkosten verlagen.

There are two common approaches to hosting multiple websites on a VPS:

  • Using a hosting control panel such as cPanel/WHM
  • Managing websites manually using a web server such as NGINX or Apache

This guide explains both methods, their advantages, and the best practices for performance, beveiliging, en schaalbaarheid.

Why Host Multiple Websites on One VPS?

Hosting several websites on a single VPS offers a number of benefits.

Reduced Hosting Costs

Instead of purchasing separate hosting plans for each website, one properly configured VPS can host multiple domains while sharing the same server resources.

Centralized Management

A single VPS allows you to manage:

Wordpress Hosting

WordPress-webhosting

Vanaf $ 3,99/maandelijks

Koop nu
  • Websites
  • SSL-certificaten
  • Databases
  • Email services
  • Back-ups

from one location.

Better Performance

A VPS provides an isolated OS and allocated virtual resources; physical CPU and storage can still be shared.

Voordelen zijn onder meer:

  • Consistente prestaties
  • Improved page loading speed
  • Better traffic handling
  • Greater control over server resources

Schaalbaarheid

As your projects grow, you can increase VPS resources without migrating every website individually.

VPS-vereisten

Before hosting multiple websites, ensure your VPS has adequate resources.

Recommended Minimum Specifications

Websites RAM CPU Opslag
1-5 Sites 2 GB 1 vCPU 40 GB
5-15 Sites 4 GB 2 vCPU 80 GB
15-30 Sites 8 GB 4 vCPU 160 GB

Actual requirements depend on:

Cheap VPS

Goedkope VPS-server

Vanaf $ 2,99/maandelijks

Koop nu
  • Website traffic
  • CMS usage
  • Database size
  • Caching implementation
  • Email hosting

Requirements Before Setup

Prepare the following:

VPS Access

You will need:

  • Root access
  • Sudo privileges
  • SSH access

Domain Names

Each website requires its own domain name.

Voorbeelden:

site1.com
site2.com
site3.com

DNS-configuratie

Each domain must point to your VPS IP address using an A record.

Voorbeeld:

Windows VPS

Windows VPS-hosting

Toegang op afstand en volledig beheer

Koop nu
site1.com    A    192.0.2.10
site2.com    A    192.0.2.10
site3.com    A    192.0.2.10

Optie 1: Hosting Multiple Websites Using cPanel

cPanel and WHM provide a graphical interface that simplifies server administration.

This method is ideal for:

  • Agentschappen
  • Wederverkopers
  • Client hosting
  • Users unfamiliar with Linux administration

Installing cPanel

Use a fresh server and verify the exact supported AlmaLinux, CloudLinux or Ubuntu release in cPanel’s requirements. The following dnf example is for AlmaLinux.

Update the server:

dnf update -y

Set hostname:

hostnamectl set-hostname server.example.com

Install cPanel:

cd /home

curl -o latest -L https://securedownloads.cpanel.net/latest

sh latest

Installation typically takes 30 naar 60 minutes.

Accessing WHM

Open:

https://SERVER-IP:2087

Login as root.

Creating Website Accounts

Navigeer naar:

WHM → Account Functions → Create a New Account

Binnenkomen:

  • Domein
  • Gebruikersnaam
  • Wachtwoord
  • E-mail

Repeat for each website.

Each account receives:

  • Separate user
  • Separate home directory
  • Independent configuration

This improves security and resource isolation.

Assigning Packages

WHM packages allow resource limits.

Example package:

Instelling Value
Disk Space 10 GB
Bandbreedte Onbeperkt
Email Accounts Onbeperkt
Databases Onbeperkt

Packages simplify client management.

Configuring DNS

Point domains to your VPS IP.

Voorbeeld:

A Record → 192.0.2.10

If using Cloudflare, update the DNS zone there.

SSL-certificaten

cPanel includes AutoSSL.

Navigeer naar:

WHM → Manage AutoSSL

Enable AutoSSL.

Certificates are:

  • Installed automatically
  • Renewed automatically
  • Applied to all domains

Benefits of cPanel

Easy Website Management

Tasks become point-and-click:

  • Create websites
  • Manage databases
  • Create email accounts
  • Install SSL

Account Isolation

Each website runs under a separate user account.

Backup Management

Built-in backup systems simplify disaster recovery.

E-mailhosting

Email services can be managed directly from cPanel.

Optie 2: Hosting Multiple Websites Without cPanel

Advanced users often prefer a lightweight VPS setup without licensing costs.

Typical stack:

  • NGINX or Apache
  • PHP-FPM
  • MariaDB or MySQL
  • Certbot

This approach reduces overhead and provides maximum control.

Installing NGINX

Ubuntu:

sudo apt update

sudo apt install nginx -y

Enable startup:

sudo systemctl enable nginx
sudo systemctl start nginx

Verifiëren:

systemctl status nginx

Creating Website Directories

The examples initially serve static HTML. For production PHP sites, create a separate system user and PHP-FPM pool per site. Keep code owned by its deployment user, permit the web server to read it, and grant write access only to required application directories. Do not make every site writable by the shared web-server account.

Create separate directories:

mkdir -p /var/www/site1.com/public_html

mkdir -p /var/www/site2.com/public_html

mkdir -p /var/www/site3.com/public_html

Set permissions:

chmod 755 /var/www/site1.com /var/www/site2.com /var/www/site3.com

Create test pages:

echo "<h1>Site 1</h1>" > /var/www/site1.com/public_html/index.html

echo "<h1>Site 2</h1>" > /var/www/site2.com/public_html/index.html

Creating NGINX Server Blocks

Create configuration:

nano /etc/nginx/sites-available/site1.com

Voorbeeld:

server {
    listen 80;
    server_name site1.com www.site1.com;

    root /var/www/site1.com/public_html;
    index index.php index.html;

    access_log /var/log/nginx/site1-access.log;
    error_log /var/log/nginx/site1-error.log;
}

Enable site:

ln -s /etc/nginx/sites-available/site1.com \
/etc/nginx/sites-enabled/

Repeat for all domains.

Testing Configuration

Verifiëren:

nginx -t

Verwachte opbrengst:

syntax is ok
test is successful

Reload:

systemctl reload nginx

Installing PHP

Insert the PHP location inside the matching server block, confirm the actual socket under /run/php and test nginx -t before reloading. Do not upload PHP source files until PHP handling is configured, or the server may expose source code. Use the appropriate per-site socket when isolating pools.

Install PHP-FPM:

apt install php-fpm php-mysql php-cli php-curl php-xml php-mbstring -y

Verifiëren:

php -v

Configure NGINX to pass PHP requests to PHP-FPM.

Voorbeeld:

location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/run/php/php8.3-fpm.sock;
}

Installing SSL Certificates

Certbot installeren:

apt install certbot python3-certbot-nginx -y

Issue certificate:

certbot --nginx -d site1.com -d www.site1.com

Repeat for each domain.

Verify renewal:

certbot renew --dry-run

Managing Multiple WordPress Sites

Voor WordPress:

Create separate:

  • Database
  • Gebruiker
  • Directory

Voorbeeld:

site1_db
site2_db
site3_db

Each WordPress installation should remain isolated.

Performance Optimization

When hosting multiple websites, resource optimization becomes important.

Caching inschakelen

NGINX FastCGI-cache:

fastcgi_cache

WordPress caching plugins:

  • LiteSpeed-cache
  • WP Rocket
  • W3 Total Cache

Use Redis

Installeren:

apt install redis-server

Redis reduces database load significantly.

Use PHP-FPM Pools

Each website can have its own PHP pool.

Voordelen:

  • Better resource allocation
  • Isolation
  • Improved stability

Monitoring Server Resources

Handige hulpmiddelen:

htop

apt install htop

Loop:

htop

Netwerkgegevens

Installeren:

Install Netdata using its maintained distribution packages or official installation documentation.

Provides:

  • CPU-gebruik
  • RAM-gebruik
  • Schijfactiviteit
  • Network monitoring

through a web dashboard.

Beste praktijken op het gebied van beveiliging

Hosting multiple websites increases the importance of server security.

Update Regularly

Keep updated:

  • Operating system
  • PHP
  • Databases
  • CMS-platforms
  • Plug-ins

Use Separate Users

Avoid running all websites under the same Linux user.

Enable Firewall

Ubuntu:

ufw allow 22
ufw allow 80
ufw allow 443

ufw enable

Installeer Fail2Ban

apt install fail2ban -y

Protects against:

  • SSH brute-force attacks
  • Login abuse
  • Automated attacks

Disable Root Login

First verify that a separate sudo user can log in with a key, keep console access available, and validate sshd -t before reloading SSH. Firewall examples assume port 22; allow your real SSH port if different.

Bewerking:

nano /etc/ssh/sshd_config

Set:

PermitRootLogin no

Start SSH opnieuw:

systemctl restart ssh

Back-upstrategie

Every multi-site VPS should have automated backups.

Aanbevolen:

Daily Website Backups

tar -czf site1-backup.tar.gz /var/www/site1.com

Database Backups

mysqldump database_name > database.sql

Offsite Storage

Store backups using:

  • Amazon S3
  • Google Drive
  • Backblaze B2
  • Secondary VPS

Follow the 3-2-1 backup rule whenever possible.

When Should You Upgrade?

Consider upgrading when:

  • CPU usage remains above 80%
  • Memory usage remains above 80%
  • One website impacts others
  • Traffic increases significantly
  • You host more than 10-20 active websites

Use measured bottlenecks and isolation needs to decide whether to upgrade; the number of websites alone is not a capacity limit.

Conclusie

Hosting multiple websites on a single VPS is an efficient and scalable solution for businesses, ontwikkelaars, agentschappen, and website owners. Users seeking simplicity can leverage cPanel and WHM for centralized management, while advanced administrators can build a lightweight and highly optimized environment using NGINX, PHP-FPM, and Let’s Encrypt.

With proper resource planning, verscherping van de veiligheid, toezicht houden, and backup procedures, a single VPS can reliably host numerous websites while maintaining strong performance and stability.

Deel dit bericht

Geef een reactie

Je e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *