You can host WordPress on an Ubuntu VPS using Nginx, MariaDB, PHP-FPM, and a free Let's Encrypt SSL certificate. This gives you control over your WordPress hosting environment, server resources, and configuration.
This step-by-step guide covers installing WordPress on Ubuntu 24.04 or 26.04 LTS, configuring Nginx, creating the database, enabling HTTPS, and verifying your website.
Need a VPS for WordPress? Explore Owned Networks KVM VPS hosting with full root access, SSD storage, and US/EU server locations.
Before You Start
- A fresh Ubuntu 24.04 or 26.04 LTS VPS with sudo/root access.
- A domain such as
example.compointing to the VPS public IP address. - Ports 80 and 443 accessible through your firewall.
- At least 2 GB RAM for a lightweight site; 4 GB or more is preferable for plugins, caching, and additional traffic.
- A backup if modifying an existing server.
Using an older Ubuntu release? See our Ubuntu 20.04 to 24.04 upgrade guide or Ubuntu 24.04 to 26.04 upgrade guide.
Step 1: Install Nginx, MariaDB, and PHP
Connect to your VPS through SSH and install the required packages:
sudo apt update && sudo apt upgrade -y sudo apt install -y nginx mariadb-server php-fpm php-mysql php-curl php-gd php-mbstring php-xml php-zip php-intl curl tar openssl sudo systemctl enable --now nginx mariadb |
Check the installed versions:
nginx -v php -v mariadb --version ls /run/php/*-fpm.sock |
Ubuntu provides the default PHP version for your installed release. Confirm compatibility with your WordPress themes and plugins before migrating a production website.
Step 2: Create the WordPress Database
Generate a strong database password:
openssl rand -hex 24 |
Save the generated password securely, then open MariaDB:
sudo mariadb |
Execute the following SQL statements, replacing REPLACE_WITH_STRONG_PASSWORD with the generated password:
CREATE DATABASE wordpress CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'REPLACE_WITH_STRONG_PASSWORD'; GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost'; EXIT; |
Keep the database name, username, and password available for the WordPress installer.
Step 3: Download and Install WordPress
Download the latest WordPress release from the official website:
|
Replace example.com with your actual domain in all subsequent commands. The folder path does not have to match the domain, but this guide uses it for clarity.
Step 4: Configure Nginx for WordPress
Set your domain and automatically detect the installed PHP-FPM socket:
|
Create the Nginx virtual host:
|
Important: Set DOMAIN to your actual domain before running these commands. They assume the Nginx site and symlink do not already exist.
Step 5: Enable Free SSL with Let's Encrypt
Verify that your domain's DNS A record points to the VPS and that your firewall allows HTTP (80) and HTTPS (443). If using UFW, allow Nginx traffic without blocking SSH:
sudo ufw allow 'Nginx Full' sudo ufw status |
Install Certbot using Snap, then obtain your free SSL certificate:
sudo apt install -y snapd sudo snap install --classic certbot sudo /snap/bin/certbot --nginx -d "$DOMAIN" sudo /snap/bin/certbot renew --dry-run |
Follow Certbot's prompts. It will request a Let's Encrypt certificate and configure HTTPS in Nginx. Certificate renewal is handled automatically by the Certbot Snap installation.
Visit https://example.com to confirm HTTPS works.
Step 6: Complete the WordPress Installation
Open your domain in a web browser:
https://example.com |
WordPress will launch its installation wizard. Enter:
- Database Name: wordpress
- Username: wpuser
- Password: your generated database password
- Database Host: localhost
- Table Prefix: wp_ or a custom prefix
Complete the setup with your website title, administrator username, strong password, and email address. Do not use admin as the administrator username.
Step 7: Verify WordPress and Server Services
Check Nginx, MariaDB, PHP-FPM, and HTTPS:
sudo nginx -t sudo systemctl status nginx mariadb --no-pager sudo systemctl --failed curl -I "https://$DOMAIN" |
Confirm that WordPress loads correctly, the administrator dashboard is accessible, and your certificate is valid.
Common WordPress VPS Installation Problems
502 Bad Gateway on Nginx
Check that PHP-FPM is running and that the socket configured in Nginx matches the installed PHP version:
ls -l /run/php/*-fpm.sock sudo nginx -t sudo tail -n 50 /var/log/nginx/error.log |
Error Establishing a Database Connection
Verify the database name, username, password, and MariaDB service status. Check the values stored in wp-config.php.
Let's Encrypt Certificate Failed
Confirm that your domain resolves to the correct public IP, that ports 80 and 443 are reachable, and that Nginx responds correctly before retrying Certbot.
WordPress Permalinks Return 404
Make sure the Nginx configuration contains try_files $uri $uri/ /index.php?$args; and that Nginx passes its configuration test.
WordPress VPS Security and Maintenance
For a production website:
- Keep Ubuntu, WordPress, PHP, plugins, and themes updated.
- Use HTTPS and strong administrator credentials.
- Maintain regular off-server backups of files and databases.
- Enable caching and monitor CPU, memory, and disk usage.
- Limit SSH access and apply appropriate firewall rules.
- Review file permissions and use a dedicated system user for stronger isolation when hosting multiple sites.
For larger sites, WooCommerce stores, and busy applications, consider additional CPU, RAM, caching, and a dedicated database strategy.
Related Solution: Host WordPress on an Owned Networks VPS
Need a VPS for WordPress Hosting?Run WordPress with full control over Nginx, PHP, databases, and server resources on an Owned Networks KVM VPS.
|
Frequently Asked Questions
Can I host WordPress on an Ubuntu VPS?
Yes. You can run WordPress on a Linux VPS using Nginx, PHP-FPM, and MariaDB or MySQL with full control over the hosting environment.
How much RAM does WordPress need on a VPS?
A lightweight WordPress installation may run on a 2 GB VPS. For plugins, WooCommerce, caching, or heavier traffic, 4 GB or more is a reasonable starting point. Actual requirements depend on the workload.
Is Nginx better than Apache for WordPress?
Both support WordPress. Nginx is commonly used for efficient static-content delivery and PHP-FPM integration, while Apache offers familiar configuration features. Performance depends on the complete hosting stack and workload.
Can I use free SSL for WordPress?
Yes. Let's Encrypt provides free TLS certificates. Certbot can configure Nginx and automate certificate renewal.
Can I install WordPress on Ubuntu 26.04?
Yes. Ubuntu 26.04 supports the necessary web server, PHP, and database components. Verify compatibility with any themes and plugins before migrating an existing website.
Is a KVM VPS suitable for WooCommerce?
Yes, provided the VPS has sufficient CPU, RAM, storage performance, and caching for the store's traffic and extensions. Production WooCommerce environments may require additional resources.
Should I choose shared hosting or a VPS for WordPress?
Shared hosting is convenient for simple websites. A VPS provides greater control over the software stack, server configuration, and resources, but also requires server administration and security maintenance.
Conclusion
Installing WordPress on an Ubuntu VPS with Nginx and free SSL gives you a customizable hosting environment for websites, blogs, and online stores.
Looking for WordPress VPS hosting? Explore Owned Networks Linux VPS Hosting and KVM VPS plans.
Last reviewed: November 2026. References: WordPress Requirements and Certbot Nginx Instructions.