How to Install WordPress on a Free VPS (2026) — Step-by-Step

Install WordPress on a Free VPS

Shared hosting is cheap until your site grows — then it’s slow, overloaded, and you have zero control. A VPS gives you a dedicated environment you own entirely, and with a free VPS you pay nothing to get started. If you’re still deciding whether to make the move, our post on shared vs VPS hosting advantages and disadvantages breaks down the differences clearly.

This guide walks through a complete WordPress installation on Ubuntu 22.04 or 24.04 using the LEMP stack (Linux, Nginx, MySQL, PHP). By the end you’ll have a production-ready WordPress site with SSL, proper file permissions, and PHP tuning — on a server that costs you nothing to run.


What You Need

  • A VPS running Ubuntu 22.04 or 24.04 — minimum 1 vCPU, 1 GB RAM, 10 GB storage
  • A domain name with its A record pointed to your VPS IP
  • SSH access (root or sudo user)
  • About 20 minutes

If you don’t have a VPS yet, VPSWala’s free VPS gives you 8-core AMD EPYC, 8 GB DDR5 ECC RAM, and 1 TB NVMe SSD — more than enough for a WordPress site, with no credit card required. Deploy Ubuntu 22.04 or 24.04, then come back here. Not sure how to get started with your new VPS? Our guide on 5 easy steps to get your VPS up and running via PuTTY covers the first connection.

DNS note: Point your domain’s A record to your VPS IP before starting — DNS propagation can take up to 48 hours and Let’s Encrypt needs it to issue the SSL certificate.


Step 1 — Get a Free VPS and Connect via SSH

Once your VPS is deployed, connect via SSH:

ssh root@YOUR_VPS_IP

If you created a non-root user during setup:

ssh username@YOUR_VPS_IP

Step 2 — Update the Server

Always start with a full system update on a fresh VPS:

sudo apt update && sudo apt upgrade -y

Install essential utilities:

sudo apt install -y curl wget unzip git ufw

Step 3 — Install Nginx

Nginx handles concurrent connections far more efficiently than Apache — lower memory usage, faster static file serving, and better performance under load. All of which matter for WordPress. For a deeper comparison, see our post on Apache vs Nginx web server which covers when to pick each.

sudo apt install -y nginx
sudo systemctl start nginx
sudo systemctl enable nginx

Open the firewall for web traffic:

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

Test it’s working — visit your VPS IP in a browser. You should see the Nginx welcome page.


Step 4 — Install PHP 8.3

WordPress fully supports PHP 8.3 and runs roughly 20% faster than PHP 8.1 due to JIT improvements. Ubuntu 24.04 ships PHP 8.3 in its default repositories. For Ubuntu 22.04, add the Ondřej Surý PPA:

# Ubuntu 22.04 only — skip this block on 24.04
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update

Install PHP-FPM and all extensions WordPress requires:

sudo apt install -y php8.3-fpm php8.3-mysql php8.3-curl php8.3-gd \
php8.3-mbstring php8.3-xml php8.3-zip php8.3-intl php8.3-opcache \
php8.3-bcmath php8.3-imagick

Verify the install:

php -v

You should see PHP 8.3.x in the output.


Step 5 — Install MySQL and Create the Database

Install MySQL:

sudo apt install -y mysql-server
sudo systemctl start mysql
sudo systemctl enable mysql

Secure the installation:

sudo mysql_secure_installation

Answer the prompts — set a root password, remove anonymous users, disable remote root login, remove test database.

Now create a database and user for WordPress:

sudo mysql -u root -p

Inside the MySQL shell:

CREATE DATABASE wordpress CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'your_strong_password_here';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Replace your_strong_password_here with an actual strong password and note it down — you’ll need it when configuring WordPress.


Step 6 — Download and Configure WordPress

Download the latest WordPress and extract it to your web root:

cd /var/www/
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xzf latest.tar.gz
sudo mv wordpress YOUR_DOMAIN_NAME
sudo rm latest.tar.gz

Replace YOUR_DOMAIN_NAME with your actual domain (e.g., example.com).

Set correct file ownership and permissions:

sudo chown -R www-data:www-data /var/www/YOUR_DOMAIN_NAME
sudo find /var/www/YOUR_DOMAIN_NAME -type d -exec chmod 755 {} \;
sudo find /var/www/YOUR_DOMAIN_NAME -type f -exec chmod 644 {} \;

Create the WordPress config file:

cd /var/www/YOUR_DOMAIN_NAME
sudo cp wp-config-sample.php wp-config.php
sudo nano wp-config.php

Update these four lines with your database details:

define( 'DB_NAME', 'wordpress' );
define( 'DB_USER', 'wpuser' );
define( 'DB_PASSWORD', 'your_strong_password_here' );
define( 'DB_HOST', 'localhost' );

Also update the security keys. Go to https://api.wordpress.org/secret-key/1.1/salt/, copy the generated block, and replace the matching section in wp-config.php.

Save and exit with Ctrl+O then Ctrl+X.


Step 7 — Configure the Nginx Server Block

Create a new Nginx configuration for your site:

sudo nano /etc/nginx/sites-available/YOUR_DOMAIN_NAME

Paste this configuration — replace YOUR_DOMAIN_NAME in both places:

server {
    listen 80;
    listen [::]:80;
    server_name YOUR_DOMAIN_NAME www.YOUR_DOMAIN_NAME;
    root /var/www/YOUR_DOMAIN_NAME;
    index index.php index.html index.htm;
 
    # Handle WordPress permalinks
    location / {
        try_files $uri $uri/ /index.php?$args;
    }
 
    # Pass PHP requests to PHP-FPM
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.3-fpm.sock;
    }
 
    # Block access to sensitive files
    location ~ /\.ht {
        deny all;
    }
 
    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt  { log_not_found off; access_log off; allow all; }
 
    location ~* \.(css|gif|ico|jpeg|jpg|js|png|webp|woff|woff2)$ {
        expires 30d;
        add_header Cache-Control "public, no-transform";
    }
}

Enable the site and test the configuration:

sudo ln -s /etc/nginx/sites-available/YOUR_DOMAIN_NAME /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/default
sudo nginx -t

If the test returns syntax is ok, reload Nginx:

sudo systemctl reload nginx

Visit your domain in a browser — you should see the WordPress installation wizard.


Step 8 — Install Free SSL with Let’s Encrypt

Every WordPress site needs HTTPS. Let’s Encrypt provides free auto-renewing certificates. For a deeper understanding of SSL types and why HTTPS matters for SEO and security, see our guide on why your website needs SSL. For managing multiple domains on the same VPS, our subdomains and Let’s Encrypt on Nginx guide covers that setup.

sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d YOUR_DOMAIN_NAME -d www.YOUR_DOMAIN_NAME

Certbot will prompt you for an email address and ask you to agree to terms. When asked whether to redirect HTTP to HTTPS, choose 2 (Redirect) — this forces all traffic to HTTPS automatically.

Verify auto-renewal works:

sudo certbot renew --dry-run

Certbot installs a cron job that auto-renews certificates before they expire. You never need to renew manually.


Step 9 — Tune PHP for WordPress

The default PHP settings are too conservative for WordPress. Edit the PHP config:

sudo nano /etc/php/8.3/fpm/php.ini

Find and update these values (use Ctrl+W to search in nano):

upload_max_filesize = 64M
post_max_size = 64M
memory_limit = 256M
max_execution_time = 300
max_input_vars = 3000

Enable OPcache — this stores compiled PHP bytecode in memory so PHP doesn’t re-parse files on every request. It’s already installed, just needs the right settings:

sudo nano /etc/php/8.3/fpm/conf.d/10-opcache.ini
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1

Restart PHP-FPM to apply all changes:

sudo systemctl restart php8.3-fpm

Step 10 — Complete the WordPress Setup

Visit https://YOUR_DOMAIN_NAME in your browser. You’ll see the WordPress installation wizard:

  1. Choose your language
  2. Enter site title, admin username, password, and email
  3. Click Install WordPress
  4. Log in at https://YOUR_DOMAIN_NAME/wp-admin

Your WordPress site is live. A few things to do immediately after installation:

  • Settings → Permalinks: Set to “Post name” for clean URLs, then save to regenerate the .htaccess rules
  • Install a caching plugin: W3 Total Cache or WP Super Cache dramatically reduces server load
  • Install a security plugin: Wordfence or iThemes Security for brute force protection — also read our guide on how to prevent brute force attacks
  • Update everything: Dashboard → Updates → run all available updates
  • Must-have plugins: Check out our list of 16 essential WordPress plugins to get your site production-ready fast

Performance Tips for WordPress on VPS

On a VPS you control the full stack — here’s what makes the biggest difference:

Optimization Impact How to do it
OPcache (done above) High — eliminates PHP parsing overhead Already enabled in Step 9
Page caching Very high — serves cached HTML, skips PHP/MySQL entirely W3 Total Cache or WP Super Cache plugin
Image optimization Medium — reduces page weight Smush or ShortPixel plugin
CDN High for global visitors Cloudflare free plan (proxy your domain)
Redis object cache High for database-heavy sites sudo apt install redis-server + Redis Object Cache plugin
Nginx FastCGI cache Very high — Nginx-level caching, no PHP Add fastcgi_cache directives to Nginx config

Troubleshooting

Problem Likely cause Fix
502 Bad Gateway PHP-FPM not running sudo systemctl restart php8.3-fpm
404 on all pages except home Permalinks not flushed or try_files missing Go to Settings → Permalinks → Save Changes. Check Nginx try_files line
SSL cert fails DNS not propagated yet Wait for DNS to propagate, then re-run certbot. Use dig YOUR_DOMAIN +short to check
Can’t upload images — file too large PHP upload limits too low Check upload_max_filesize and post_max_size in php.ini. Also update client_max_body_size in Nginx config
White screen of death PHP error or memory limit Check /var/log/nginx/error.log and increase memory_limit in php.ini
Database connection error Wrong credentials in wp-config.php Double-check DB_NAME, DB_USER, DB_PASSWORD in wp-config.php match what you set in MySQL

Your WordPress site is running on a VPS you fully control. No shared hosting limits, no mystery server slowdowns, no surprise bills. The entire stack — Nginx, PHP 8.3, MySQL, OPcache, SSL — is tuned for WordPress from the ground up.

The VPSWala Professional free trial with 8-core AMD EPYC and 8 GB DDR5 ECC RAM comfortably handles 10–20 WordPress sites with traffic — performance comparable to plans at $30–50/month from other providers, on a 30-day free trial with no credit card required. Need Windows Server with RDP instead of Linux? grab a free Windows VPS here and follow our guide on installing SSL certificates on Windows VPS.

Next steps: set up automated VPS backups to protect your WordPress data, and read our guide on securing and firewalling your VPS server to lock down your new setup.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *