How to Keep a Multi-Site Cloud Server Secure

How to Keep a Multi-Site Cloud Server Secure

Introduction Running multiple websites on one cloud server saves money and simplifies management. It also concentrates risk. If one site gets compromi

Introduction

Running multiple websites on one cloud server saves money and simplifies management. It also concentrates risk. If one site gets compromised, the others may be exposed. A shared cloud server with weak isolation is a single bad plugin away from a full breach.

Multi-site cloud server security is not just about installing a firewall and hoping for the best. It is about isolating each site, securing every domain with SSL, and hardening the cloud server so a single mistake does not take everything down.

This article will explain how to keep a multi-site cloud server secure from several angles, including database isolation, file permissions, SSL for multiple domains, and more.

Why Isolation Matters More on a Shared Cloud Server

On a single-site cloud server, a compromised application usually affects one site. On a multi-site cloud server, the blast radius is larger.

Common risks include:

· One site’s vulnerability allowing access to another site’s files.

· A shared database user giving one site access to another site’s data.

· A misconfigured directory permission letting a lower-trust site read sensitive files.

· A shared SSL certificate exposing domain names or causing browser warnings.

· A resource-heavy site starving others through CPU, memory, or disk IO.

Isolation is the first line of defense. It does not make attacks impossible, but it limits how far they spread.

Database Isolation

Each site should have its own database and its own database user. Do not let multiple sites share one database user.

A safe pattern looks like this:

  1. Create a separate database for each site.

  2. Create a separate user for each site.

  3. Grant that user access only to its own database.

  4. Use a strong, unique password for each user.

  5. Avoid granting ALL PRIVILEGES unless the application truly needs it.

Example:

CREATE DATABASE blog_db;
CREATE USER 'blog_user'@'localhost' IDENTIFIED BY 'strong-password';
GRANT ALL PRIVILEGES ON blog_db.* TO 'blog_user'@'localhost';
FLUSH PRIVILEGES;

Repeat for each site with its own database and user. If one site’s credentials leak, the attacker cannot pivot to another site’s database.

Also consider restricting database access to localhost or a private network interface. Do not expose MySQL or PostgreSQL directly to the public internet.

File Structure and Permissions

A clean directory layout makes isolation easier to manage.

/var/www/
├── site1/
├── site2/
└── site3/

Each site lives in its own directory. Set ownership and permissions so that one site’s process cannot read or write another site’s files.

Example:

sudo chown -R www-data:www-data /var/www/site1
sudo chmod -R 755 /var/www/site1

For sensitive files, use stricter permissions:

· Directories: 755 or 750

· Files: 644 or 640

· Configuration files with credentials: 600

Please avoid 777 permissions. Even though it is convenient, it puts your sites at risk.

If your setup allows it, run each site under its own system user instead of a shared www-data. This adds another layer of isolation.

SSL for Multiple Domains

Every site on the cloud server should have its own SSL certificate. Do not use one certificate to cover unrelated domains if you can avoid it.

Options include:

· Separate certificates per domain using Let’s Encrypt.

· SAN certificates covering multiple domains.

· Wildcard certificates for subdomains of one domain.

For most multi-site setups, separate certificates per domain are easier to manage and rotate.

With Certbot and Nginx:

sudo certbot --nginx -d example.com -d www.example.com

Repeat for each domain. Certbot can handle renewal automatically.

A few things to watch:

  1. Make sure each domain’s Nginx server block has the correct server_name.

  2. Redirect HTTP to HTTPS for every site.

  3. Renew certificates before they expire. Automate this.

  4. Keep private keys readable only by root or the web service user.

Cloud Server Hardening Basics

Isolation and SSL are not enough on their own. The cloud server itself needs hardening.

1. Firewall

Allow only the ports you need. Typically:

· 22 for SSH (consider changing the port)

· 80 for HTTP

· 443 for HTTPS

Block everything else by default.

2. SSH access

Use key-based authentication. Disable password login. Disable root login over SSH. Consider fail2ban to block repeated failed attempts.

3. Fail2Ban

Fail2Ban watches logs and bans IPs that show malicious behavior. Configure jails for SSH, Nginx, and any other exposed service.

4. Regular updates

Keep the OS, web service, database, and application dependencies updated. Most breaches exploit known vulnerabilities that already have patches.

5. Least privilege

Run services with the minimum privileges they need. Do not run web applications as root.

6. Logging and monitoring

Keep logs for Nginx, the database, and authentication. Monitor for unusual activity. A breach you notice early is a breach you can contain.

Performance Isolation

Security and performance overlap on a multi-site cloud server. One site consuming all CPU, memory, or disk IO can degrade or crash the others.

Consider:

· Limiting resources per site using cgroups or container limits.

· Separating high-traffic sites onto their own cloud server or container.

· Monitoring resource usage per site.

· Using a reverse proxy with rate limiting for public-facing sites.

Performance isolation is not just about fairness. It prevents one site from becoming a denial-of-service risk to the others.

Final Thoughts

Multi-site cloud server security comes down to isolation, SSL, and hardening. Give each site its own database and user. Separate file directories and permissions. Use individual SSL certificates. Harden SSH, firewall, Fail2Ban, and updates. Add performance isolation so one site cannot starve the rest.

Running multiple sites on one cloud server is efficient. Doing it securely requires deliberate configuration. The steps are not complicated, but skipping them is how one small problem becomes a cloud server-wide incident.

If you run multiple sites on one cloud server, leave a comment about how you handle isolation.

Thank you very much for reading to the end!

Comment