How to Install WordPress on Ubuntu 19.10 with Nginx, MariaDB and PHP 7.3-FPM

Here is how you can install WordPress on Ubuntu 19.10 with Nginx, MariaDB and PHP 7.3-FPM. In particular on Vultr‘s instance i.e. Ubuntu 19.10.

Prerequisites

  • Have an Ubuntu 19.10 x64 instance.
  • Logged in as a root with sudo privileges.
  • Installed Nginx, MariaDB and PHP-FPM

To get started with the installation of WordPress, follow the steps below:

Step 1: Create WordPress Database

To logon to MariaDB database server, run the following commands:

sudo mysql -u root -p

Then create a database called yourname_live

CREATE DATABASE yourname_live;

Now create a database user called yourname_live_user with a new password

CREATE USER 'yourname_live_user'@'localhost' IDENTIFIED BY 'your_password_here';

And grant the user full access to the database.

GRANT ALL ON yourname_live.* TO 'yourname_live_user'@'localhost' IDENTIFIED BY 'your_password_here' WITH GRANT OPTION;

Finally, save your changes and exit.

FLUSH PRIVILEGES;
EXIT;

Step 2: Download WordPress Latest Release

To get WordPress latest release, go to its official download page and get it from there. The following link is from where we can find latest WordPress archive versions.

cd /tmp
wget https://wordpress.org/latest.tar.gz
tar -xvzf latest.tar.gz
sudo mv wordpress /var/www/html/yourprojectname

Now run the commands below to set the correct permissions for WordPress root directory and give Nginx control

sudo chown -R www-data:www-data /var/www/html/yourprojectname/
sudo chmod -R 755 /var/www/html/yourprojectname/

Step 3: Configure Nginx

Finally, configure Nginx site configuration file for WordPress. This file will control how users access WordPress content. Run the following commands to create a new configuration file called yourprojectname

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

Copy and paste the following content into ‘yourprojectname’ file and save it. Replace the highlighted line with your own domain name and directory root location.

#yourprojectname configuration
server {
    listen 80 default_server;
    listen [::]:80 default_server;
    root /var/www/html/yourprojectname;
    
    # Add index.php to the list if you are using PHP
    index index.php index.html index.htm;

    server_name yourprojectname.com www.yourprojectname.com;

    client_max_body_size 100M;

    autoindex off;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

Save the file and exit.

Step 4: Enable the WordPress

After configuring the VirtualHost above, enable it by running the commands below

sudo ln -s /etc/nginx/sites-available/yourprojectname /etc/nginx/sites-enabled/
sudo systemctl restart nginx.service

Then open your browser and browse to the server domain name. You should see WordPress setup wizard to complete. Please follow the wizard carefully.

https://yourdomainname.com

Follow the on-screen instructions. i.e. select the installation language and click Continue.

WordPress Setup Step 1

You will need to know the following

Before getting started, we need some information on the database. You will need to know the following items before proceeding.

  1. database_name
  2. database_username
  3. database_password
  4. database_host
  5. Table prefix (if you want to run more than one WordPress in a single database)

WordPress will going to use this information to create a wp-config.php file.

WordPress Setup Step 2

Next, you should enter your database connection details and if you’re not sure about these, contact your host.

WordPress Setup Step 3

After that, click Run the installation to complete the WordPress setup.

WordPress Setup Step 4

Next, fill in the WordPress site information and then click Install WordPress

WordPress Setup Step 5

You’re done. WordPress is installed now and ready to use.

Related Post

How to Install WordPress 5.2.3 on Ubuntu 16.04 / 18.04 / 18.10 with Apache2, MariaDB and PHP 7.2

Here is how you can install WordPress on Ubuntu. In particular on Vultr’s instance i.e. Ubuntu 16.04 / 18.04 LTS / 18.10.

How to Install MariaDB on Ubuntu 16.04 / 18.04 / 18.10

Here is how you can install MariaDB on Ubuntu. In particular on Vultr’s instance i.e. Ubuntu 16.04 / 18.10 and 18.04 LTS.

Leave your comment