How to Host a WordPress Website on a VPS — Complete Setup Guide

// TL;DR

// 1. Why Host WordPress on a VPS

Shared hosting is fine when you're starting out, but it comes with real limitations: resource contention with other tenants, no root access, restrictive PHP and MySQL configurations, and little control over server-level caching or security.

A VPS changes everything. You get dedicated resources, full root access, and the ability to tune PHP, MySQL, and Apache exactly how WordPress needs them. Your site runs on its own isolated environment, not sharing CPU and RAM with hundreds of other accounts.

When to upgrade from shared to VPS:

// 2. VPS Requirements for WordPress

Use Case RAM CPU Storage Recommended Plan
Business site / WooCommerce (5-50K visits/mo) 4 GB 3 vCPU 40 GB SSD VPS Medium ($39.99/mo)
High-traffic / multisite (50K+ visits/mo) 8 GB 4 vCPU 50 GB SSD VPS Premium ($64.99/mo)

For most WordPress sites, VPS Start ($24.99/mo) is the sweet spot: 2 vCPU Xeon cores, 2 GB RAM, 30 GB SSD, and 3 TB bandwidth. Running WooCommerce or expecting higher traffic? VPS Medium ($39.99/mo) gives you 4 GB RAM, 3 vCPU, and unmetered bandwidth.

// 3. Step-by-Step: WordPress Setup on a VPS

1

Order Your VPS

Want WordPress pre-installed? Select "Other (Raise a Ticket)" from the OS dropdown and mention "WordPress on LAMP stack" in your ticket. We'll deliver your VPS with Apache, MySQL, PHP, WordPress, and SSL certificate all configured — just point your domain and start building. No extra cost.

Setting it up yourself? Choose Ubuntu 22.04 LTS and follow along.

2

Install the LAMP Stack

Once your VPS is provisioned, connect via SSH and install Linux, Apache, MySQL, and PHP:

# Connect to your VPS ssh root@YOUR_SERVER_IP # Update system sudo apt update && sudo apt upgrade -y # Install Apache sudo apt install apache2 -y sudo systemctl enable apache2 # Install MySQL sudo apt install mysql-server -y sudo mysql_secure_installation # Install PHP and required extensions sudo apt install php php-mysql php-curl php-gd \ php-mbstring php-xml php-xmlrpc php-zip \ php-intl libapache2-mod-php -y # Restart Apache sudo systemctl restart apache2
3

Create the WordPress Database

Log into MySQL and create a dedicated database and user for WordPress:

# Log into MySQL sudo mysql # Create database and user CREATE DATABASE wordpress; CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'your_secure_password'; GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost'; FLUSH PRIVILEGES; EXIT;
4

Download and Install WordPress

Download the latest WordPress release and move it into your web root:

# Download WordPress cd /tmp wget https://wordpress.org/latest.tar.gz tar -xzf latest.tar.gz # Move to web root sudo mv wordpress /var/www/html/ sudo chown -R www-data:www-data /var/www/html/wordpress sudo chmod -R 755 /var/www/html/wordpress # Configure WordPress cd /var/www/html/wordpress sudo cp wp-config-sample.php wp-config.php sudo nano wp-config.php

In wp-config.php, update the database connection details:

define('DB_NAME', 'wordpress'); define('DB_USER', 'wpuser'); define('DB_PASSWORD', 'your_secure_password'); define('DB_HOST', 'localhost');
Pro tip: Generate unique authentication keys at https://api.wordpress.org/secret-key/1.1/salt/ and paste them into wp-config.php for better security.
5

Configure Apache Virtual Host

Create an Apache configuration file for your WordPress site:

sudo nano /etc/apache2/sites-available/wordpress.conf

Add the following configuration:

<VirtualHost *:80> ServerName yourdomain.com ServerAlias www.yourdomain.com DocumentRoot /var/www/html/wordpress <Directory /var/www/html/wordpress> AllowOverride All Require all granted </Directory> </VirtualHost>

Enable the site and required Apache modules:

# Enable the site and mod_rewrite sudo a2ensite wordpress.conf sudo a2enmod rewrite sudo systemctl restart apache2
6

Set Up SSL with Let's Encrypt

Secure your site with a free SSL certificate from Let's Encrypt:

# Install Certbot sudo apt install certbot python3-certbot-apache -y # Get SSL certificate sudo certbot --apache -d yourdomain.com -d www.yourdomain.com # Auto-renewal is configured automatically sudo certbot renew --dry-run
7

Complete WordPress Setup

Visit https://yourdomain.com in your browser to finish the installation:

  1. Choose your language
  2. Set your site title, admin username, password, and email
  3. Click "Install WordPress"
  4. Log in to your WordPress dashboard at /wp-admin

That's it — your WordPress site is live on your own VPS.

// 4. Essential WordPress Plugins

These four plugins cover the fundamentals every WordPress site needs:

◆ Security: Wordfence

Firewall, malware scanner, login security. The most popular WordPress security plugin. Blocks brute-force attacks and monitors file changes in real time.

◆ Performance: WP Rocket

Caching, minification, lazy loading. Dramatically speeds up your site with minimal configuration. Worth the investment for any production site.

◆ SEO: Yoast SEO

On-page SEO analysis, sitemaps, meta tags. Essential for search visibility. Guides you through optimizing every post and page for search engines.

◆ Backups: UpdraftPlus

Scheduled backups to cloud storage. One-click restore when things go wrong. Supports Google Drive, Dropbox, S3, and more.

// 5. Performance Optimization Tips

A VPS gives you the control to optimize WordPress at the server level. Here are the most impactful changes:

  1. Enable PHP OPcache — Caches compiled PHP bytecode so scripts don't need to be re-parsed on every request
  2. Configure MySQL query cache — Stores the results of frequent queries in memory for faster retrieval
  3. Set up browser caching headers — Tell browsers to cache static assets so returning visitors load faster
  4. Use a CDN — Cloudflare's free tier works great and serves your static assets from edge servers worldwide
  5. Optimize images before uploading — Use WebP format and compress images before upload, not after
  6. Keep plugins minimal — Every plugin adds load time. Remove anything you're not actively using
Pro tip: Enable OPcache by adding these lines to your php.ini:
opcache.enable=1 opcache.memory_consumption=128 opcache.max_accelerated_files=10000 opcache.revalidate_freq=60

// 6. Pre-Installation & Custom Setup

Don't want to set it up yourself? DejavuHost offers WordPress pre-installation at no extra cost.

  1. Select "Other (Raise a Ticket)" from the OS dropdown during checkout
  2. In your ticket, mention "WordPress on LAMP stack"
  3. Complete your order as normal
  4. Our team provisions your VPS with the full LAMP stack, WordPress installed, and SSL configured
  5. You receive SSH credentials — point your domain and start building immediately

This also works for other CMS platforms: Joomla, Drupal, Ghost, or any other application you need. No extra cost, no hassle — your server arrives ready to use.

// 7. Security Best Practices

◆ Keep Everything Updated

WordPress core, plugins, and themes. Enable auto-updates for minor releases. Outdated software is the number one cause of WordPress hacks.

◆ Strong Passwords

Use unique passwords for WP admin, MySQL, and SSH. Never reuse passwords across services. A password manager makes this easy.

◆ Limit Login Attempts

Install a plugin to block brute-force attacks. Consider two-factor authentication for all admin accounts.

◆ Regular Backups

Automated daily backups with UpdraftPlus. Store copies offsite (S3, Google Drive). Test your restores periodically.

◆ File Permissions

wp-config.php should be 640 or 644. Directories 755, files 644. Never set anything to 777.

◆ Disable XML-RPC

Unless you specifically need it for Jetpack or the WordPress mobile app. It's a common attack vector for brute-force attempts.

// 8. Wrap-Up

WordPress on a VPS gives you the performance and control that shared hosting can't match. You get dedicated resources, root access, and the ability to optimize every layer of the stack.

VPS Start ($24.99/mo) is plenty for blogs, portfolios, and small business sites. VPS Medium ($39.99/mo) handles WooCommerce, membership sites, and higher traffic with ease.

Or skip the setup entirely — tell us "WordPress on LAMP" when ordering and we'll deliver it ready to use.

Ready to launch your WordPress site?

Get a VPS with full LAMP stack and start building today.

VPS Plans
From $11.99/mo
Dedicated
From $69/mo
Locations
12
Uptime SLA
99.9%