How to Install WordPress on a VPS (LEMP Stack)
A complete, copy-paste walkthrough to install WordPress on Ubuntu with Nginx, MariaDB and PHP — the fast LEMP stack — plus free HTTPS at the end.

This is a complete walkthrough to install WordPress on a fresh Ubuntu VPS using the LEMP stack — Linux, Enginx (Nginx), MariaDB and PHP — the lean, fast foundation that outperforms shared hosting. By the end you'll have a live WordPress site with free HTTPS. Commands are copy-paste ready.
Before you start
You'll need a VPS with root or sudo access and a domain pointed at its IP. If you haven't done that yet, see how to point a domain to your VPS and how to connect to a VPS via SSH. Start from a secure baseline with the first 10 minutes on a new VPS.
Step 1: Install Nginx, MariaDB and PHP
Update the system and install the stack:
sudo apt update && sudo apt upgrade -y
sudo apt install -y nginx mariadb-server php-fpm php-mysql \
php-curl php-gd php-xml php-mbstring php-zip php-imagick
Allow web traffic through the firewall:
sudo ufw allow 'Nginx Full'
sudo ufw allow OpenSSH
sudo ufw enable
Step 2: Create the database
Secure MariaDB, then create a database and user for WordPress:
sudo mysql_secure_installation
sudo mysql
Inside the MariaDB prompt:
CREATE DATABASE wordpress;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'a-strong-password';
GRANT ALL ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Use a genuinely strong password — see how to generate a strong password.
Step 3: Download WordPress
Fetch and place WordPress in the web root:
cd /tmp && curl -O https://wordpress.org/latest.tar.gz
tar xzf latest.tar.gz
sudo mv wordpress /var/www/yoursite
sudo chown -R www-data:www-data /var/www/yoursite

Step 4: Configure Nginx
Create a server block at /etc/nginx/sites-available/yoursite:
server {
listen 80;
server_name yoursite.com www.yoursite.com;
root /var/www/yoursite;
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;
}
}
Enable it and reload:
sudo ln -s /etc/nginx/sites-available/yoursite /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
Step 5: Finish the install and add HTTPS
Visit http://yoursite.com and complete the famous five-minute WordPress installer, entering the database name, user and password from Step 2.
Then add free HTTPS with Certbot:
sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d yoursite.com -d www.yoursite.com
For more on certificates, see free SSL certificates with Let's Encrypt.
Next steps
Now make it fast and safe: speed up WordPress with caching and secure your WordPress site on a VPS. For the reasoning behind choosing a VPS at all, read best VPS for WordPress.
Set correct permissions and ownership
A common source of "why won't WordPress update?" or "why can't I upload media?" is file ownership and permissions. WordPress needs the web server user (www-data on Ubuntu) to own its files, with sensible permissions — writable enough to work, tight enough to be safe:
sudo chown -R www-data:www-data /var/www/yoursite
sudo find /var/www/yoursite -type d -exec chmod 755 {} \;
sudo find /var/www/yoursite -type f -exec chmod 644 {} \;
Directories at 755 and files at 644 is the standard, secure baseline. The wp-config.php file, which holds your database credentials, can be tightened further to 640. Getting this right up front prevents a whole category of frustrating permission errors later.
Point your domain and go live
With WordPress installed and secured, the last step is connecting your domain so visitors reach it by name rather than IP:
- Create an A record at your DNS provider pointing your domain to the server's IP address — see how to point a domain to your VPS.
- Wait for propagation — DNS changes take time to spread; DNS propagation explained covers why and how long.
- Confirm the Nginx
server_namematches your domain, then reload Nginx. - Run Certbot once DNS resolves, so your HTTPS certificate is issued for the real domain.
After that, set your Site Address and WordPress Address under Settings, and you're live on your own domain with a valid padlock. From here, the natural next steps are performance and hardening — both covered below — plus regular automated backups so a mistake is never permanent.
Where Nxeon fits
Nxeon offers NVMe KVM VPS with one-click OS images and full root, so this whole stack installs cleanly — or start from WordPress VPS hosting for a head start. Moving an existing site? Use free migration help.
FAQ
What is the LEMP stack?
LEMP is Linux, Nginx (the "E" is for its "engine-x" pronunciation), MariaDB/MySQL and PHP. It's a lean, high-performance stack for WordPress, generally handling concurrency better than Apache-based LAMP.
Should I use Nginx or Apache for WordPress?
Nginx with PHP-FPM handles concurrent traffic more efficiently and is the common performance choice. Apache is more flexible with .htaccess rules. For speed under load, Nginx (LEMP) is the recommendation.
How do I add HTTPS to WordPress?
Install Certbot and run sudo certbot --nginx -d yoursite.com. It obtains a free Let's Encrypt certificate, configures Nginx and sets up automatic renewal — giving your site the padlock at no cost.
Do I need a lot of RAM to install WordPress?
No. A basic WordPress site installs and runs on a 1–2 GB VPS. Step up to 4 GB for a busy site with caching, more PHP workers, or WooCommerce.
Ready to build? Start with WordPress VPS hosting or compare plans on pricing.