Back to Articles
Web Hosting

How to Set Up a VPS for Your Website: A Practical Guide

By Emad, Cloud Infrastructure Architect
How to Set Up a VPS for Your Website: A Practical Guide

A VPS (Virtual Private Server) gives you dedicated resources — CPU, RAM, and storage — on a shared physical server. It’s the sweet spot between cheap shared hosting and expensive dedicated servers, offering better performance and full control over your environment.

If your site is outgrowing shared hosting, here’s how to set up a VPS properly.

Step 1: Choose the Right Provider

Look for providers offering:

  • High uptime guarantees (99.9%+)
  • SSD storage for faster disk I/O
  • Responsive support with reasonable response times
  • Flexible scaling so you can upgrade resources without migration

Managed vs. Unmanaged: Managed hosting handles server maintenance, updates, and security for you — ideal if you don’t have sysadmin skills. Unmanaged gives you full control but requires technical knowledge.

Step 2: Initial Server Setup

After purchasing your plan, you’ll receive SSH credentials. Connect to your server:

ssh root@your-server-ip

First things first — update everything:

# Ubuntu/Debian
apt update && apt upgrade -y

# CentOS/RHEL
yum update -y

Then create a non-root user with sudo privileges and disable root login:

adduser deploy
usermod -aG sudo deploy

Edit /etc/ssh/sshd_config and set PermitRootLogin no, then restart SSH.

Step 3: Configure Your Web Server

Install your web server of choice:

# NGINX (recommended for most sites)
apt install nginx -y

# Or Apache
apt install apache2 -y

NGINX is generally preferred for static content and reverse proxying. Apache is better if you need .htaccess support. LiteSpeed is another option with excellent PHP performance.

Set up your domain’s server block, upload your site files, and install an SSL certificate:

apt install certbot python3-certbot-nginx -y
certbot --nginx -d yourdomain.com -d www.yourdomain.com

Step 4: Set Up a Firewall

Only allow traffic on the ports you need:

# UFW on Ubuntu
ufw allow 22/tcp    # SSH
ufw allow 80/tcp    # HTTP
ufw allow 443/tcp   # HTTPS
ufw enable

Step 5: Install Your Database

For database-driven sites (WordPress, custom apps):

apt install mysql-server -y
mysql_secure_installation

Or use MariaDB as a drop-in MySQL replacement. For PHP sites, install PHP and required extensions:

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

Step 6: Secure Your Server

Security is ongoing, not one-time:

  • Install Fail2Ban to block brute-force SSH attempts: apt install fail2ban -y
  • Use SSH keys instead of passwords for remote access
  • Keep software updated — set up unattended security updates
  • Monitor login attempts and server resource usage
  • Set up automatic backups to a remote location (different server or cloud storage)

The Payoff

VPS setup takes effort upfront, but the gains in performance, reliability, and control are significant. Your site loads faster, you can customize everything, and you’re not sharing resources with hundreds of other sites.


Need help with VPS setup? Contact Web Roots — we handle the technical details so you can focus on your business.