Skip to main content
To install WordPress on an Ubuntu 24.04 VPS, install Nginx, MariaDB and PHP-FPM, create a database and user, download https://wordpress.org/latest.tar.gz into /var/www/wordpress, set the database details in wp-config.php, and add an Nginx server block with try_files $uri $uri/ /index.php?$args;. Add HTTPS with Certbot, then finish the setup at https://example.com/wp-admin/install.php.

Before you start

  • Point your domain’s A record at the server: point a domain.
  • Take a snapshot or backup if the server already hosts something.
  • Use a user with sudo. If you are root, leave out sudo.
  • WordPress recommends PHP 8.3 or newer, MariaDB 10.11+ or MySQL 8.0+, and HTTPS. Ubuntu 24.04 and Debian 13 meet these out of the box.

How to install Nginx, MariaDB and PHP

These are the extensions WordPress lists as required or highly recommended. For a full walkthrough, firewall rules and AlmaLinux / Rocky commands, see install a LEMP stack. Then secure the database:

How to create the WordPress database

Use your own strong password. More options are in create a MySQL database and user.

How to download and configure WordPress

1

Download and unpack

2

Create wp-config.php

Set the database details:
Replace the block of put your unique phrase here lines with fresh keys from https://api.wordpress.org/secret-key/1.1/salt/.
3

Set ownership

PHP-FPM runs as www-data on Ubuntu and Debian and must be able to write uploads and updates:

How to configure Nginx for WordPress

Create /etc/nginx/sites-available/wordpress:
Use php8.4-fpm.sock on Debian 13 (check with php -v). The try_files line sends pretty permalinks to index.php. client_max_body_size allows uploads up to 64 MB; raise PHP’s limits to match with increase PHP upload size. Enable the site, test and reload:

How to add HTTPS and finish the install

1

Get a certificate

See free SSL with Certbot.
2

Run the installer

Open https://example.com/wp-admin/install.php. Choose the language, site title, an admin username (not admin), a strong password and your email.
3

Log in

Log in at https://example.com/wp-admin/. Set Settings > Permalinks to Post name and save.
AlmaLinux / Rocky: use the LEMP guide’s commands, /etc/nginx/conf.d/wordpress.conf, fastcgi_pass unix:/run/php-fpm/www.sock;, and sudo chown -R apache:apache /var/www/wordpress (the default PHP-FPM pool user is apache). With SELinux enforcing, also run sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/wordpress/wp-content(/.*)?" and sudo restorecon -Rv /var/www/wordpress so uploads work.

How to check it worked

  • https://example.com shows your new site with a padlock.
  • Tools > Site Health in the dashboard lists missing PHP extensions or HTTPS problems.
  • Upload an image under Media > Add New to confirm write permissions.

Frequently asked questions

I see “Error establishing a database connection”. What now?

The values in wp-config.php do not match the database. Test them with mariadb -u wpuser -p wordpress. If that login fails, recreate the user with the SQL above.

WordPress asks for FTP details when I install a plugin. Why?

PHP cannot write to the WordPress folder. Run the chown command again for the user PHP-FPM runs as (www-data or apache). The try_files $uri $uri/ /index.php?$args; line is missing from your server block. Add it, run sudo nginx -t and reload Nginx.

How do I back up WordPress?

Back up both the files in /var/www/wordpress and the database. See back up MySQL databases and back up a Linux server.

VPS and dedicated server guides

Every server guide in one place.

Install a LEMP stack

The base WordPress runs on.

Increase PHP upload size

Fix upload size errors.

Free control panels

Manage sites in a browser.

Linux security checklist

Harden the server too.

Checked against the official WordPress requirements, WordPress installation guide and WordPress hosting handbook on 4 November 2026; packages, SQL and the Nginx configuration tested on Ubuntu 24.04 LTS (Nginx 1.24.0, MariaDB 10.11, PHP 8.3.6). The WordPress download itself and the browser installer were not run in the test. Commands can differ on other distributions or releases.

Need Extra Help?

If you encounter any issues, our support team is ready to assist:

Save on Your Hosting

Ready to upgrade your hosting? Use code KB20 at checkout for 20% off your first order!

Last Updated: November 2026