Introduction
UN Serveur privé virtuel (VPS) fournit une plate-forme flexible et rentable pour héberger plusieurs sites Web sur un seul serveur. Que vous gériez des projets personnels, sites clients, environnements de développement, ou applications métiers, la consolidation de plusieurs domaines sur un seul VPS peut simplifier la gestion tout en réduisant les coûts d'hébergement.
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, sécurité, et évolutivité.
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.
Gestion centralisée
A single VPS allows you to manage:
Hébergement Web WordPress
À partir de 3,99 $/mois
- Sites Web
- Certificats SSL
- Bases de données
- Services de messagerie
- Sauvegardes
from one location.
Better Performance
A VPS provides an isolated OS and allocated virtual resources; physical CPU and storage can still be shared.
Les avantages incluent:
- Des performances constantes
- Improved page loading speed
- Better traffic handling
- Greater control over server resources
Évolutivité
Au fur et à mesure que vos projets grandissent, you can increase VPS resources without migrating every website individually.
VPS Requirements
Before hosting multiple websites, ensure your VPS has adequate resources.
Recommended Minimum Specifications
| Sites Web | BÉLIER | Processeur | Stockage |
|---|---|---|---|
| 1-5 Sites | 2 FR | 1 CPU virtuel | 40 FR |
| 5-15 Sites | 4 FR | 2 CPU virtuel | 80 FR |
| 15-30 Sites | 8 FR | 4 CPU virtuel | 160 FR |
Actual requirements depend on:
Serveur VPS pas cher
À partir de 2,99 $/mois
- Website traffic
- CMS usage
- Database size
- Caching implementation
- Email hosting
Requirements Before Setup
Prepare the following:
VPS Access
Vous aurez besoin:
- Accès racine
- Privilèges Sudo
- Accès SSH
Domain Names
Each website requires its own domain name.
Exemples:
site1.com
site2.com
site3.com
Configuration DNS
Each domain must point to your VPS IP address using an A record.
Exemple:
Hébergement VPS Windows
Accès à distance et administrateur complet
site1.com A 192.0.2.10
site2.com A 192.0.2.10
site3.com A 192.0.2.10
Option 1: Hosting Multiple Websites Using cPanel
cPanel and WHM provide a graphical interface that simplifies server administration.
This method is ideal for:
- Agences
- Revendeurs
- 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’les exigences. 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 à 60 minutes.
Accessing WHM
Ouvrir:
https://SERVER-IP:2087
Login as root.
Creating Website Accounts
Accédez à:
WHM → Account Functions → Create a New Account
Entrer:
- Domaine
- Nom d'utilisateur
- Mot de passe
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:
| Paramètre | Value |
|---|---|
| Espace disque | 10 FR |
| Bande passante | Illimité |
| Comptes de messagerie | Illimité |
| Bases de données | Illimité |
Packages simplify client management.
Configuring DNS
Point domains to your VPS IP.
Exemple:
A Record → 192.0.2.10
If using Cloudflare, update the DNS zone there.
Certificats SSL
cPanel includes AutoSSL.
Accédez à:
WHM → Manage AutoSSL
Enable AutoSSL.
Certificates are:
- Installed automatically
- Renewed automatically
- Applied to all domains
Benefits of cPanel
Gestion facile du site Web
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.
Hébergement de messagerie
Email services can be managed directly from cPanel.
Option 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 ou 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
Vérifier:
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
Exemple:
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
Vérifier:
nginx -t
Résultat attendu:
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
Vérifier:
php -v
Configure NGINX to pass PHP requests to PHP-FPM.
Exemple:
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
}
Installing SSL Certificates
Installer Certbot:
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
Pour WordPress:
Create separate:
- Base de données
- User
- Directory
Exemple:
site1_db
site2_db
site3_db
Each WordPress installation should remain isolated.
Optimisation des performances
When hosting multiple websites, resource optimization becomes important.
Activer la mise en cache
Cache NGINX FastCGI:
fastcgi_cache
WordPress caching plugins:
- Cache LiteSpeed
- WP Fusée
- Cache total W3
Use Redis
Installer:
apt install redis-server
Redis reduces database load significantly.
Use PHP-FPM Pools
Each website can have its own PHP pool.
Avantages:
- Better resource allocation
- Isolation
- Improved stability
Monitoring Server Resources
Useful tools:
htop
apt install htop
Courir:
htop
Données réseau
Installer:
Install Netdata using its maintained distribution packages or official installation documentation.
Provides:
- Utilisation du processeur
- Utilisation de la RAM
- Activité du disque
- Network monitoring
through a web dashboard.
Meilleures pratiques de sécurité
Hosting multiple websites increases the importance of server security.
Update Regularly
Keep updated:
- Système opérateur
- PHP
- Bases de données
- Plateformes CMS
- Plugins
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
Install 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.
Modifier:
nano /etc/ssh/sshd_config
Set:
PermitRootLogin no
Restart SSH:
systemctl restart ssh
Backup Strategy
Every multi-site VPS should have automated backups.
Recommended:
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:
- Amazone S3
- Google Drive
- Backblaze B2
- Secondary VPS
Follow the 3-2-1 backup rule whenever possible.
When Should You Upgrade?
Envisagez une mise à niveau lorsque:
- 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.
Conclusion
Hosting multiple websites on a single VPS is an efficient and scalable solution for businesses, développeurs, agences, 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 Chiffrer.
With proper resource planning, renforcement de la sécurité, surveillance, and backup procedures, a single VPS can reliably host numerous websites while maintaining strong performance and stability.
