TutorialsJune 15, 20263 min read

How to host WordPress on a VPS

Run WordPress on your own VPS for speed and control. This LEMP-stack guide covers Nginx, MariaDB, PHP, the WordPress install, and free HTTPS.

NBy Nxeon

Hosting WordPress on your own VPS gives you far more speed and control than crowded shared hosting — dedicated resources, your own caching, and root access to tune everything. This guide builds a LEMP stack (Linux, Nginx, MariaDB, PHP) and installs WordPress on top.

Step 1: Update and install the stack

On a fresh Ubuntu VPS:

sudo apt update && sudo apt upgrade -y
sudo apt install nginx mariadb-server php-fpm php-mysql php-curl php-gd php-xml php-mbstring php-zip -y

Step 2: Secure MariaDB and create the database

Lock down the database server:

sudo mysql_secure_installation

Answer the prompts to set a root password and remove test data. Then create a database and user for WordPress:

sudo mysql

At the MariaDB prompt:

CREATE DATABASE wordpress;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'a-strong-password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 3: Download WordPress

cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar xzf latest.tar.gz
sudo mv wordpress /var/www/example.com
sudo chown -R www-data:www-data /var/www/example.com

Step 4: Configure Nginx

Create /etc/nginx/sites-available/example.com:

server {
    listen 80;
    server_name example.com www.example.com;
    root /var/www/example.com;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

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

Adjust the fastcgi_pass socket to match your PHP version if needed (check ls /run/php/). Enable and reload:

sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx

Step 5: Run the WordPress installer

Point your domain's A record at the VPS, then open http://example.com in a browser. WordPress asks for the database name, user and password you created, then walks you through setting a site title and admin account. A minute later your site is live.

Step 6: Add free HTTPS

sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d example.com -d www.example.com

Step 7: Firewall

sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw enable

Performance tips

WordPress on a VPS can be very fast if you help it:

  • Enable object caching with Redis: sudo apt install redis-server php-redis -y and a caching plugin.
  • Use a page-cache plugin so most visitors get static HTML.
  • Give it enough PHP memory — raise memory_limit in your PHP-FPM pool for heavier themes.
  • NVMe matters — WordPress makes many small database queries per page, exactly the workload fast storage accelerates. Nxeon runs NVMe across all plans, so pages render quickly.

Prefer not to do this by hand?

Every step above is manual on purpose so you understand the stack. If you'd rather click, a control panel like CyberPanel (with its LiteSpeed cache) or HestiaCP installs and manages WordPress for you — both are one-click images on Nxeon. CyberPanel's one-click WordPress + LSCache is especially quick to a fast, cached site.

Sizing

A single WordPress site runs comfortably on 2 GB of RAM and 2 vCPU; add resources for high traffic or many plugins. Start there, watch free -h and your page times, and resize if needed.

With this stack you own the whole thing — server, database, cache and TLS — and your WordPress site is faster and more private than it ever was on shared hosting.

#wordpress#lemp#nginx#mariadb#vps

Deploy your first server in under a minute

No credit card required to get started. Spin up a VPS, break things, and only pay for what you keep running.