Short answer: On a fresh Ubuntu VPS: secure SSH and enable a firewall, install Nginx, PHP-FPM and MariaDB, create a database, download WordPress, configure Nginx, add a free Let's Encrypt certificate, then set up caching, automatic updates and off-site backups. A VPS 1 with 2 GB RAM, $5.00 a month at AuroxHost, runs a busy WordPress site comfortably.
Running WordPress on your own VPS gives you guaranteed resources, full control over the software and room to grow. It also makes you responsible for security and updates. This guide sets up a fast, secure WordPress server on Ubuntu with Nginx, PHP-FPM and MariaDB.
If you would rather not manage a server, a WordPress hosting plan gives you the same WordPress without the system administration. See managed vs unmanaged hosting.
What you need
- A VPS running a current Ubuntu LTS release, with at least 1 vCPU and 2 GB RAM.
- A domain name pointed at the VPS's IP address with an A record. See DNS records explained.
- An SSH client. See how to use SSH.
Step 1: Secure the server
Log in as root, update the system and create a normal user:
apt update && apt upgrade -y
adduser deploy
usermod -aG sudo deploy
Copy your SSH key to the new user, then disable password logins and direct root login in /etc/ssh/sshd_config (PasswordAuthentication no, PermitRootLogin no) and restart SSH.
Turn on the firewall, allowing only SSH and web traffic:
ufw allow OpenSSH
ufw allow 'Nginx Full'
ufw enable
More detail in the UFW firewall guide and VPS first steps.
Step 2: Install Nginx, PHP and MariaDB
apt install -y nginx mariadb-server php-fpm php-mysql php-curl php-gd php-intl php-mbstring php-xml php-zip php-imagick
Secure the database server:
mysql_secure_installation
Check which PHP version was installed with php -v, and use it in the Nginx configuration below. See which PHP version and MySQL vs MariaDB.
Step 3: Create the database
mysql -u root -p
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'a-long-random-password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Step 4: Download WordPress
cd /var/www
curl -O https://wordpress.org/latest.tar.gz
tar xzf latest.tar.gz && rm latest.tar.gz
mv wordpress example.com
chown -R www-data:www-data /var/www/example.com
Set safe file permissions: folders 755 and files 644. See file permissions on Linux.
Step 5: 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;
client_max_body_size 64M;
location / { try_files $uri $uri/ /index.php?$args; }
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
}
location ~* \.(css|js|jpg|jpeg|png|webp|svg|woff2)$ { expires 30d; access_log off; }
location ~ /\.(?!well-known) { deny all; }
}
Replace the PHP socket with your version, then enable the site and reload Nginx:
ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
nginx -t && systemctl reload nginx
Step 6: Add a free SSL certificate
apt install -y certbot python3-certbot-nginx
certbot --nginx -d example.com -d www.example.com
Certbot renews the certificate automatically. See free SSL certificates and www or no www.
Step 7: Run the WordPress installer
Visit your domain, choose your language, enter the database name, user and password from step 3, and create your admin account with a strong password. Then:
- Set permalinks to "Post name". See WordPress permalinks.
- Delete unused themes and plugins.
- Turn on two-factor login. See secure the WordPress login.
Step 8: Make it fast
- OPcache is on by default with PHP-FPM; check it is enabled. See PHP OPcache.
- Object cache: install Redis and a Redis object cache plugin. See Redis object cache.
- Page cache: use a caching plugin, or Nginx FastCGI cache for advanced setups.
- Compression: enable gzip or Brotli. See gzip and Brotli.
- Images: serve WebP and lazy-load. See image optimisation.
Step 9: Backups and updates
- Enable automatic security updates for the system:
apt install unattended-upgrades. - Let WordPress apply minor updates automatically; test major updates on a staging site.
- Back up the database and
wp-contentdaily to storage outside the VPS, and take a VPS snapshot before big changes. See backups vs snapshots.
Step 10: Monitor
Set up uptime monitoring and alerts for disk space, memory and failed logins. See server monitoring.
Choosing a region and size
Put the VPS close to your readers: Lagos for Nigeria and West Africa, London or Amsterdam for Europe. Start with VPS 1 ($5.00/mo) for one busy site, VPS 2 ($12.00/mo) for WooCommerce or several sites. See VPS hosting in Nigeria.
Frequently asked questions
Is WordPress faster on a VPS?
Under load, yes, because resources are guaranteed and you can tune caching. For small sites, good shared hosting with caching is just as fast.
Should I use Apache or Nginx?
Both work well. Nginx with PHP-FPM uses less memory under heavy traffic. See LiteSpeed vs Apache vs Nginx.
Can I install cPanel on my VPS instead?
Yes, if you prefer a control panel. It needs a paid licence. See cPanel on a VPS.
Can AuroxHost move my WordPress site to a VPS?
Yes. Our team migrates WordPress sites to a VPS for free, including the database and email.



